[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Classes' (#rtl)

# TCollectionSortCompare

Callback to sort collection items

## Declaration

Source position: classesh.inc line 520

`type TCollectionSortCompare = function(`
`Item1: TCollectionItem;`
`Item2: TCollectionItem`
`):Integer;`

## Description

TCollectionSortCompare is the prototype for a callback used in the TCollection.Sort method. The procedure should compare Item1 and Item2 and return an integer:

Result < 0
  if Item1 comes before Item2
Result = 0
  if Item1 is at the same level as Item2
Result > 0
  if Item1 comes after Item2

## See also

TCollection.Sort |  | Sort the items in the collection