Compares this instance to the specified Object.
[Visual Basic] Overridable Public Function CompareTo( _ ByVal value As Object _ ) As Integer [C#] public virtual int CompareTo( object value ); [C++] public: virtual int CompareTo( Object* value ); [JScript] public function CompareTo( value : Object ) : int;
Value | Description |
---|---|
A negative integer | If this instance is less than the object. |
Zero | If this instance and the object are equal. |
A positive integer | If this instance is greater than the object. |
A positive integer | If the object is null. This is a special case. |
Exception Type | Condition |
---|---|
ArgumentException | If the object is a non-null reference and is not a Double. |
In the comparison of two Double values, the canonical ordering is used. As a special case, an instance, regardless of its value, is considered to be greater than a null object reference.
Note false will be returned if NaN. Not a number (NaN) should never be used for comparing.
The value parameter must be a Double type and not a null object reference.
Double Structure | Double Members | System Namespace | Object | Int32