If one calls the .Max()
extension method on an IEnumerable<T>
, and the objects within do not implement IComparable
, one gets System.ArgumentException: At least one object must implement IComparable.
Why don't Max
and similar methods constrain T
to implement IComparable
, so that this problem can be caught at compile time instead of at run time?