RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
IComparer.Compare Method

Compare is a generic method of comparing two values.

Pascal
function Compare(const Left: T; const Right: T): Integer;
C++
__fastcall int Compare(const T Left, const T Right);

Use the Compare method to compare two values of the same type. Any class that implements the IComparer interface should provide an implementation for the Compare method.  

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

Return value  
Description  
Result is less than zero (<0)  
Left is less than Right.  
Result is equal to zero(=0)  
Left is equal to Right.  
Result is greater than zero(>0)  
Left is greater than Right.  

 

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