Compares the current object to another object. The UInt32 type is not CLS compliant. The CLS-compliant alternative is Int32.
[C#] public virtual int CompareTo( object value ); [C++] public: virtual int CompareTo( Object* value ); [JScript] public function CompareTo( value : Object ) : int;
[Visual Basic] The UInt32 type cannot be used in Visual Basic.
Value | Meaning |
---|---|
Less than 0 | The current object is less than the specified object. |
0 | The current object is equal to the specified object. |
Greater than 0 | The current object is greater than the specified object. |
Exception Type | Condition |
---|---|
ArgumentException | If the object is not a UInt32 type. |
The CompareTo method determines whether the relationship of the current object to another object and returns an integer that indicates that relationship.
The object must be a UInt32 type. The value null is less than any instance.
Note You need to use compare rather than subtraction because it will wrap large negative numbers to positive.
UInt32 Structure | UInt32 Members | System Namespace | Object