'Which comes first?' vs. 'Are they equal?'

by Michael S. Kaplan, published on 2006/04/29 11:41 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2006/04/29/586726.aspx

Remember how I have talked in the past about the difference between two different purposes for collation (comparison vs. identity, or alternately the difference between CompareString and EqualString)?

(if not you can follow those links for some of the backstory!)

Over on the BCLTeam WebLog, Krzysztof Cwalina explains about Why IComparable<T> does not extend IEquatable<T>.

Basically the same issue -- in most cases, one does not need to answer both the "which comes first?" and the "are they equal?" questions when two objects of the same type are being looked at.

Even when they are fairly basic items like strings, when both questions are valid in different contexts, the use of the strings themselves often suggests that only one of them is appropriate at a given time....


This post brought to you by "<" (U+ff1c, a.k.a. FULLWIDTH LESS-THAN SIGN)

no comments

Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

referenced by

2010/03/15 Thus the problems resist solution, and the workarounds are often inadequate

2007/09/18 A&P of Sort Keys, part 8 (aka You can often think of ignoring weights as a form of ignorance)

2006/08/01 Sometimes, ignoring case is stupid

go to newer or older post, or back to index or month or day