Chapter 4 - Using .NET Standard Types

  1. 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 each char variable uses 2 bytes due to the internal use of Unicode (UTF-16) encoding for characters.
  2. 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's PasswordBox control stores the password as a SecureString variable, and when starting a new process, the Password parameter must be a SecureString variable. For more discussion, visit:
    • http://stackoverflow.com/questions/141203/when-would-i-need-a-securestring-in-net
  3. When is it appropriate to use a StringBuilder?
    • When concatenating more than about three string variables, you will use less memory and get improved performance using StringBuilder than using string.Concat method or the + operator.
  4. When should you use a LinkedList<T>?
    • Each item in a linked list has a reference to its previous and next siblings as well as the list itself so should be used when items need to be inserted and removed from positions in the list without actually moving the items in memory.
  5. When should you use a SortedDictionary variable rather than a SortedList variable?
  6. What is the ISO culture code for Welsh?
            cy-GB 
    
  7. What is the difference between localization, globalization, and internationalization?
    • Localization affects the user interface of your application. Localization is controlled by a neutral (language only) or specific (language and region) culture. You provide multiple language versions of text and other values. For example, the label of a text box might be First name in English, and PrĂ©nom in French.
    • Globalization affects the data of your application. Globalization is controlled by a specific (language and region) culture, for example, en-GB for British English, or fr-CA for Canadian French. The culture must be specific because a decimal value formatted as currency must know to use Canadian dollars instead of French Euros.
    • Internationalization is the combination of localization and globalization.
  8. In a regular expression, what does $ mean?
    •  $ represents the end of the input.
  9. In a regular expression, how would you represent digits?
    •  d+
    • [0-9]+
  10. Why should you not use the official standard for e-mail addresses to create a regular expression to validate a user's e-mail address?
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.74.231