Dan Crevier's Blog

In search of a better name...

Comparing strings in Whidbey

There are new guidelines for comparing strings in Whidbey. The summary has the main points:

Summary: 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.

Then, there are lots of gorey details. String comparison is far more complicated than it seems at first.

Published Friday, June 10, 2005 11:44 PM by dancre

Comments

 

Heath Stewart said:

re: String comparison is far more complicated that it seems at first.

No doubt! Check-out Michael Kaplan's blog at http://blogs.msdn.com/michkap/ for all the gory details about internationalization.
June 11, 2005 1:20 PM
 

David Smith said:

Thanks for the update!
June 11, 2005 2:46 PM
New Comments to this post are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker