RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
IComparable.CompareTo Method

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

Pascal
function CompareTo(Value: T): Integer;
C++
__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  
Description  
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!