Stable Sort
This class provides stable sort for the IList<T>
, that is, if two elements are equal, their order will be preserved.
A default List<T>.Sort()
implementation performs an unstable sort: order might not preserved for elements that are equal.
StableSort.Sort(list, (a, b) => a.Field.CompareTo(b.Field), reverse: false);