Insert(Index: Integer; Value: Variant);
Index. Index of the position, to which the element should be added.
Value. Element value that should be added.
The Insert method adds an element with the specified value to the specified position.
Sub UserProc;
Var
ArrayL: IArrayList;
i: Integer;
Begin
ArrayL := New ArrayList.Create;
For i := 0 To Math.RandBetweenI(0, 100) Do
ArrayL.Add(Math.RandBetweenI(0, 100));
End For;
ArrayL.Insert(0, "First");
End Sub UserProc;
After executing the example a dynamic array with random values is created, and one more element with the specified value is added to the first position.
See also: