InsertRange(Index: Integer; Collection: ICollection);
Index. Index of the position, to which the collection should be added to.
Collection. Elements collection that should be added to the array.
The InsertRange method inserts the elements collection into the specified position.
Sub UserProc;
Var
ArrayL, ArrayL1: IArrayList;
i: Integer;
Begin
ArrayL := New ArrayList.Create;
ArrayL1 := New ArrayList.Create;
For i := 0 To Math.RandBetweenI(50, 100) Do
ArrayL.Add(Math.RandBetweenI(0, 100));
End For;
For i := 0 To Math.RandBetweenI(50, 100) Do
ArrayL1.Add(Math.RandBetweenI(0, 100));
End For;
ArrayL.InsertRange(Double.FloorInt(ArrayL.Count / 2), ArrayL1 As ICollection);
End Sub UserProc;
After executing the example two dynamic arrays are generated, and values of the second one are added to the middle of the first one.
See also: