I was interested in whether it would be faster to sort my classes using LINQ, or by implementing the IComparable interface and List.Sort. I was quite surprised when the LINQ cod
If you make sure everything is JITed before starting the measure, you might get different results (I also recommend using the Stopwatch
class to measure time):
var ll = ts2.ToList();
ll.Sort();
ll.OrderBy(item => item.Age).ToList();
According to my measurements (after adding the above code), IComparable is always faster (even in debug).