Mono Class Library: System.Enum Overview | Members

System.Enum.CompareTo Method

Returns the sort order of the current instance compared to the specified object. [Edit]

public int CompareTo (object target)

Parameters

target
An object to compare the current instance to. [Edit]

Returns

The return value is a negative number, zero, or a positive number reflecting the sort order of the current instance as compared to target. For non-zero return values, the exact value returned by this method is unspecified. The following table defines the return value:

Return ValueDescription
A negative integerThe value of the current instance is less than the value of target.
ZeroThe value of the current instance is equal to the value of target.
Any positive integerThe value of the current instance is greater than the value of target, or target is null.
[Edit]

Exceptions

TypeReason
ArgumentExceptiontarget and the current instance are not of the same enumeration type. [Edit]

Remarks

Note: This method is implemented to support the IComparable interface.
[Edit]

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0