The CompareTo()
method for my class is dynamic, and can range from a simple comparison to comparisons on a number of columns. This is all determined at run time, and it works great.
But in some cases, I want any attempt to sort a collection of my objects using the default comparison to just do nothing.
Having CompareTo()
just return a 0 for any comparison, to my surprise, doesn't work. The list gets rearranged in some odd, seemingly-random order.
Is there a way to do this in the CompareTo()
method implementation? I'd rather not handle this up at the collection level by having to override Sort().