[Overview][Constants][Types][Classes][Index] | Reference for unit 'fgl' (#rtl)

# TFPGObjectList

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

Generic object list

## Declaration

Source position: fgl.pp line 164

`type generic TFPGObjectList <T>= class(TFPSList)`
`public`
`constructor Create();` |  | Instantiate a new object list.
`function Add();` |  | Add new object of class T to the list.
`function Extract();` |  | Extract an item from the list
`property First: T; [rw]` |  | First non-nil item
`function GetEnumerator;` |  | Return a list enumerator for T.
`function IndexOf();` |  | Index of item
`procedure Insert();` |  | Insert a new object in the list
`property Last: T; [rw]` |  | Last non-Nil object
`procedure AddList();` |  | Adds the elements from another list
`procedure Assign();` |  | Copy objects from Source list
`function Remove();` |  | Remove an object from the list.
`procedure Sort();` |  | Sort the objects in the list
`property Items []: T; default; [rw]` |  | Indexed access to objects in the list.
`property List: PTypeList; [r]` |  | Internal list pointer
`property FreeObjects: Boolean; [rw]` |  | Does the list own the objects or not?
`end;`

## Inheritance

`TFPGObjectList` |  | Generic object list
`TFPSList` |  | Basic list of memory blocks
`TObject` |  | Base class of all classes.

## Description

TFPGList can be used to specialize a list for any class type T that does not require reference counting (such as interfaced objects). It will specialize to a list with the same methods as TFPSList or classes.TFPList or TFPObjectList

## See also

TFPSList |  | Basic list of memory blocks
classes.TFPList |  | Class to manage collections of pointers.