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

# TObjectList

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

List to manage object instances.

## Declaration

Source position: contnrs.pp line 72

`type TObjectList = class(TList)`
`public`
`constructor create();` |  | Create a new object list.
`function Add();` |  | Add an object to the list.
`function Extract();` |  | Extract an object from the list.
`function Remove();` |  | Remove (and possibly free) an element from the list.
`function IndexOf();` |  | Search for an object in the list
`function FindInstanceOf();` |  | Search for an instance of a certain class
`procedure Insert();` |  | Insert an object in the list.
`function First;` |  | Return the first non-nil object in the list
`function Last;` |  | Return the last non-nil object in the list.
`property OwnsObjects: Boolean; [rw]` |  | Should the list free elements when they are removed.
`property Items: TObject; default; [rw]` |  | Indexed access to the elements of the list.
`end;`

## Inheritance

`TObjectList` |  | List to manage object instances.
`TList,IFPObserved`
`TObject`

## Description

TObjectList is a TList descendent which has as the default array property TObjects instead of pointers. By default it also manages the objects: when an object is deleted or removed from the list, it is automatically freed. This behaviour can be disabled when the list is created.

In difference with TFPObjectList, TObjectList offers a notification mechanism of list change operations: insert, delete. This slows down bulk operations, so if the notifications are not needed, TFPObjectList may be more appropriate.

## See also

#rtl.classes.TList
TFPObjectList |  | TFPList descendent which manages objects.
TComponentList |  | List to manage component instances.
TClassList |  | List of classes.

Documentation generated on: Feb 26 2014