In the MSDN documentation on IComparable.CompareTo() :
By definition, any object is compared more (or follows) null, and two null references are compared with each other.
This can also be seen from the Double.CompareTo(object) documentation:
Returns a positive integer if this instance is greater than the value. -or- This instance is a number and a value, not a number (NaN). -or-value is a null reference (Nothing in Visual Basic).
As Adam Haldsworth points out, if something.CompareTo(somethingElse) throws an exception when somethingElse is null, then sorting and similar things will require a lot of extra exception handling.
Jlrishe
source share