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

# TCollection.Exchange

Exchange 2 items in the collection

## Declaration

Source position: classesh.inc line 562

`public procedure TCollection.Exchange(`
`const Index1: Integer;`
`const index2: Integer`
`);`

## Description

Exchange exchanges the items at indexes Index1 and Index2 in the collection.

## Errors

If one of the two indexes is invalid (less than zero or larger than the number of items) an EListError exception is raised.

## See also

Items |  | Indexed array of items in the collection.
TCollectionItem.Index |  | Index of the item in its managing collection TCollection.Items property.