Chapter 4 – Using Common .NET Types

  1. Does every assembly that you create have a reference to the mscorlib.dll assembly?

    No. Although by default every assembly will have an automatic reference to the mscorlib.dll assembly, there is a compiler flag that can prevent this. For details, visit:

    https://msdn.microsoft.com/en-us/library/fa13yay7.aspx

  2. What is the maximum number of characters that can be stored in a string variable?

    The maximum size of a string variable is 2 GB or about 1 billion characters because each char variable uses 2 bytes due to the internal use of Unicode (UTF-16) encoding for characters.

  3. When and why should you use the SecureString type?

    The string type leaves text data in memory for too long and it's too visible. The SecureString ...

Get C# 6 and .NET Core 1.0: Modern Cross-Platform Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.