System.IComparable.CompareTo

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function CompareTo(Obj: TObject): Integer;
function CompareTo(Value: T): Integer;

C++

virtual int __fastcall CompareTo(TObject* Obj) = 0 ;
HIDESBASE virtual int __fastcall CompareTo(T Value) = 0 ;

Properties

Type Visibility Source Unit Parent
function public
System.pas
System.hpp
System IComparable

Description

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

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.



See Also