Suppose I have a class with an integer Day
property and an IEnumerable
of objects where the days are 2, 3, 4, 1, 3, 3 and 5 (in that order
OrderBy
is documented as being stable, if that is what you mean; so: you shouldn't need to do anything.
Enumerable.OrderBy
This method performs a stable sort; that is, if the keys of two elements are equal, the order of the elements is preserved. In contrast, an unstable sort does not preserve the order of elements that have the same key.