Method Compare
Compare(object, object)
Compares two objects and returns a value indicating whether one is less than, equal to, or greater than the other.
public int Compare(object x, object y)
Parameters
Returns
- int
A signed integer that indicates the relative values of
xandy, as shown in the following table.Value Meaning Less than zeroxis less thany. Zeroxequalsy. Greater than zeroxis greater thany.
Exceptions
- ArgumentException
Neither
xnoryimplements the IComparable interface.-or-xandyare of different types and neither one can handle comparisons with the other.