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

System.Collections.ArrayList.GetRange Method

Returns a ArrayList that represents the specified range of the current instance.

public virtual ArrayList GetRange (int index, int count)

Parameters

index
A int that specifies the zero-based index in the current instance at which the range starts. This value is between 0 and the ArrayList.Count of the current instance minus count , inclusive.
count
A int that specifies the number of elements in the range. This value is between 0 and the ArrayList.Count of the current instance minus index , inclusive.

Returns

A ArrayList that represents the range in the current instance from index to index + count - 1.

Exceptions

TypeReason
ArgumentOutOfRangeException

index < 0.

-or-

count < 0.

ArgumentExceptionArrayList.Count of the current instance - index < count.

Remarks

Operation
As described above.

This method does not create copies of the elements: the new ArrayList instance is a view window into the source list. Therefore, all subsequent changes to the source list must be done through this view window ArrayList . If changes are made directly to the source list, the view window list is invalidated and any operations on it throw InvalidOperationException .

Requirements

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