So, I have a few object
instances, and I want to put them in a consistent order. It doesn't matter what the order is, as long as I can repeat it on any pair of instances, and get the same order. (Assume unique instances.)
Is there any way to do this without relying upon the instances' values? (I know that RuntimeHelpers.GetHashCode
can get a consistent hash for each instance without worrying about its value, but the hash isn't guaranteed to be unique.)
Basically, I'm asking for an implementation of IComparer<object>
.