Mono Class Library: System.Collections.ArrayList Overview | Members

System.Collections.ArrayList.InsertRange Method

Inserts the elements of the specified ICollection at the specified index of the current instance.

public virtual void InsertRange (int index, ICollection c)

Parameters

index
A int that specifies the index in the current instance at which the new elements are inserted. This value is between 0 and the ArrayList.Count of the current instance, inclusive.
c
The ICollection whose elements are inserted into the current instance.

Exceptions

TypeReason
ArgumentNullExceptionc is null.
ArgumentOutOfRangeException

index < 0.

index > ArrayList.Count of the current instance.

NotSupportedExceptionThe current instance is read-only or has a fixed size.

Remarks

Operation
As described above.

If the ArrayList.Count of the current instance plus the size of ICollectionc is greater than the ArrayList.Capacity of the current instance, the capacity of the current instance is either doubled or increased to the new count, whichever yields a greater capacity. The internal array is reallocated to accommodate the new elements. If index is equal to the ArrayList.Count of the current instance, the elements of c are added to the end of the current instance.

The order of the elements in the ICollectionc is preserved in the current instance.

Requirements

Namespace: System.Collections
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0