I am getting strange behaviour using the built-in C# List.Sort function with a custom comparer.
For some reason it sometimes calls the comparer class\'s Compare meth
Marc's answer is useful. I agree with him that the NullReference is due to calling CompareTo on a null property. Without needing an extension class, you can do:
mylist.Sort((x, y) => (Comparer.Default.Compare(x.SomeProp, y.SomeProp)));
where SomePropType is the type of SomeProp