System.Classes.TList.Insert

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure Insert(Index: Integer; Item: Pointer);

C++

void __fastcall Insert(int Index, void * Item);

Properties

Type Visibility Source Unit Parent
procedure
function
public
System.Classes.pas
System.Classes.hpp
System.Classes TList

Description

Adds an object to the Items array at the position specified by Index.

Call Insert to add Item to the middle of the Items array. The Index parameter is a zero-based index, so the first position in the array has an index of 0. Insert adds the item at the indicated position, shifting the item that previously occupied that position, and all subsequent items, up. Insert increments Count and, if necessary, allocates memory by increasing the value of Capacity.

To replace a nil (Delphi) or NULL (C++) pointer in the array with a new item, without growing the Items array, set the Items property.

See Also