New Recommendations for Using Strings in Microsoft .NET 2.0

Code owners previously using the InvariantCulture for string comparison, casing, and sorting should strongly consider using a new set of String overloads in Microsoft .NET 2.0. Specifically, data that is designed to be culture-agnostic and linguistically irrelevant should begin specifying overloads using either the StringComparison.Ordinal or StringComparison.OrdinalIgnoreCase members of the new StringComparison enumeration. These enforce a byte-by-byte comparison similar to strcmp that not only avoids bugs from linguistic interpretation of essentially symbolic strings, but provides better performance.

4 Comments

  1. 2005-06-15 9:38 pm
  2. 2005-06-16 1:29 am
  3. 2005-06-16 2:19 am
  4. 2005-06-16 3:43 am