System.Generics.Defaults.IComparer.Compare

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function Compare(const Left, Right: T): Integer;

C++

virtual int __fastcall Compare(const T Left, const T Right) = 0 ;

Properties

Type Visibility Source Unit Parent
function public
System.Generics.Defaults.pas
System.Generics.Defaults.hpp
System.Generics.Defaults IComparer

Description

Compare is a generic method of comparing two values.

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.



See Also