Chapter 4 - Using .NET Standard Types
- What is the maximum number of characters that can be stored in a
string
?- The maximum size of a
string
variable is 2 GB or about 1 billion characters because eachchar
variable uses 2 bytes due to the internal use of Unicode (UTF-16) encoding for characters.
- The maximum size of a
- When and why should you use a
SecureString
?- The string type leaves text data in memory for too long and it's too visible. The
SecureString
type encrypts the text and ensures that the memory is released immediately. WPF'sPasswordBox
control stores the password as aSecureString
variable, and when starting a new process, thePassword
parameter must be aSecureString
variable. For more discussion, visit: - http://stackoverflow.com/questions/141203/when-would-i-need-a-securestring-in-net ...
- The string type leaves text data in memory for too long and it's too visible. The
Get C# 7 and .NET Core: Modern Cross-Platform Development - Second Edition 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.