If I pass in a custom IComparer to an instance of a List’s Sort() method, will the comparer’s Compare(x,y) method ever be called with the same item?
ie. Is it possible that Compare(x,x) may be called.
Edit: More interested in the case where items of the list are distinct.
I wrote a test program to try it out. It looks like it actually does Compare() the same element to itself (at least Compare() is called for the same item twice). In this program, Compare() is called with arguments (2, 2).
And the output is: