RAD Studio VCL Reference
IComparable.CompareTo Method

CompareTo is a generic method used to compare two instances of a class.

function CompareTo(Value: T): Integer;
__fastcall int CompareTo(T Value);

Use the CompareTo method to compare two instances of the same class. Any class that implements the IComparable interface should provide an implementation for the CompareTo method.  

The return value of Compare must be in the following ranges.

Return value  
Result is less than zero (<0)  
The object is less than Value.  
Result is equal to zero(=0)  
The object is equal to Value.  
Result is greater than zero(>0)  
The object is greater than Value.  


Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!