by Michael S. Kaplan, published on 2005/06/02 03:00 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2005/06/02/424128.aspx
Dave Fetterman reported yesterday on the Official Guidance: New Recommendations for Strings in .NET 2.0 (full paper here).
Now this is a paper whose recommendations I think are incredibly important (some of them were I daresay inspired by things I have been saying here about invariant versus ordinal and using uppercasing!). And I think at the core of those recommendations is a principle that applies to all code that is written, managed and unmanaged, in any version of any product. So I don't want people to think "I'm not using Whidbey, so this does not apply to me."
That core principle? Stated simply....
Use appropriate comparison methods.
It simply makes no sense to use the wrong method, ever.
Now as I have mentioned before, I am a bigger fan of what I call the 'vertical method' (different flag values in a single method or function) as opposed to the 'horizontal method' (different methods or functions). I find it easier to explain, easier to document, and easier for a user to know what to call. I explain this in part for unmanaged code in my post Similar descriptions does not mean similar methodologies and some day soon I will follow up with a managed version of that post.
But it is important no matter whether you are a 'vertical' person or a 'horizontal' one to choose appropriate methods to compare based on your actual scenario.
This post brought to you by "๚" (U+0e5a, a.k.a. THAI CHARACTER ANGKHANKHU)
# Maurits [MSFT] on 2 Jun 2005 10:28 AM:
# Michael S. Kaplan on 2 Jun 2005 12:11 PM:
# Ben on 2 Jun 2005 1:27 PM:
# Michael S. Kaplan on 2 Jun 2005 3:07 PM:
# kurakuraninja on 5 Jul 2005 12:51 PM:
referenced by
2006/08/16 Something .NET does more intuitively than Windows
2006/08/12 Getting string comparisons of file names right
2005/07/05 'Need more input, Stephanie!'
2005/06/12 Browsing the shoals of managed string comparisons
2005/06/07 My first (bloggers) geek dinner and the sequelae, at Orlando TechEd 2005
2005/06/05 The dasBlog 'Turkish I' thing figured out
2005/06/05 What will I answer questions about?