Compares this object to another 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 object. |
Zero | If this instance and object have the same value. |
A positive integer | If this instance is greater than object. |
A positive integer | If object is a null reference (in Visual Basic Nothing). This is a special case. |
Exception Type | Condition |
---|---|
ArgumentException | If the object is not null and is not an Int16 type. |
The CompareTo method compares this object to another object and returns an integer that indicates the relationship. It must be either an Int16 type or a null reference.
Whencomparing two Int16 values, canonical ordering is used. As a special case, an instance, regardless of its value, is considered to be greater than a null reference.
The object parameter must be either an Int16 type or a null reference.
Int16 Structure | Int16 Members | System Namespace | Object | UInt32