Compares the current value to that of an object.
[Visual Basic] Overridable Public Function CompareTo( _ ByVal target As Object _ ) As Integer [C#] public virtual int CompareTo( object target ); [C++] public: virtual int CompareTo( Object* target ); [JScript] public function CompareTo( target : Object ) : int;
A number represtenting the relationship:
Return Value | Description |
---|---|
-1 | The value of this instance is less than the value of target. |
0 | The value of this instance is equal to the value of target. |
1 | The value of this instance is greater than the value of target. |
Exception Type | Condition |
---|---|
ArgumentNullException | The target parameter is a null reference (in Visual Basic Nothing). |
ArgumentException | The object is from an enumeration that differs in type from enumType. |
ExecutionEngineException | The underlying type of this enumeration is unsupported. |
If target is not an enumeration type, it is converted to a type compatible with the underlying type of this enumeration before comparison.