IList.Insert

Syntax

Insert(Index: Integer; Value: Variant);

Parameters

Index - index of position where the element should be added.

Value - value of the element that should be added.

Description

The Insert method adds an element with the Value value into the Index position.

Example

Sub Main;

Var

ArrayL: IArrayList;

List: IList;

i: Integer;

Begin

ArrayL:=New ArrayList.Create;

List:=ArrayL As IList;

For i:=0 To Math.RandBetweenI(0,100) Do

List.Add(Math.RandBetweenI(0,100));

End For;

List.Insert(0,"First");

End Sub Main;

After executing the example a dynamic array with random values is created, and one more element is added to the first position.

See also:

IList