ArrayList.SetRange Method (Int32, ICollection)

 

Copies the elements of a collection over a range of elements in the ArrayList.

Namespace:   System.Collections
Assembly:  mscorlib (in mscorlib.dll)

abstract SetRange : 
        index:int *
        c:ICollection -> unit
override SetRange : 
        index:int *
        c:ICollection -> unit

Parameters

index
Type: System.Int32

The zero-based ArrayList index at which to start copying the elements of c.

c
Type: System.Collections.ICollection

The ICollection whose elements to copy to the ArrayList. The collection itself cannot be null, but it can contain elements that are null.

Exception Condition
ArgumentOutOfRangeException

index is less than zero.

-or-

index plus the number of elements in c is greater than Count.

ArgumentNullException

c is null.

NotSupportedException

The ArrayList is read-only.

ArrayList accepts null as a valid value and allows duplicate elements.

The order of the elements in the ICollection is preserved in the ArrayList.

This method is an O(n + 1) operation, where n is Count.

The following code example shows how to set and get a range of elements in the ArrayList.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Return to top
Show: