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

# TCollection.Sort

Sort the items in the collection

## Declaration

Source position: classesh.inc line 564

`public procedure TCollection.Sort(`
`const Compare: TCollectionSortCompare`
`);`

## Description

Sort sorts the items in the collection, and uses the Compare procedure to compare 2 items in the collection. It is more efficient do use this method than to perform the sort manually, because the list items are manipulated directly.

For more information on how the Compare function should behave, see the TCollectionSortCompare type.

## See also

TCollectionSortCompare |  | Callback to sort collection items