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

System.Collections.ArrayList.GetEnumerator Method

Returns a IEnumerator for the specified section of the current instance.

public virtual IEnumerator GetEnumerator (int index, int count)

Parameters

index
A int that specifies the index of the current instance before which the enumerator is initially placed. This value is greater than or equal to 0, and less than the ArrayList.Count of the current instance.
count
A int that specifies the number of elements, beginning with index , in the current instance over which the enumerator can iterate. This value is greater than or equal to 0, and less than or equal to the ArrayList.Count of the current instance minus index .

Returns

A IEnumerator that can iterate over the range of index to index + count - 1 in the current instance.

Exceptions

TypeReason
ArgumentOutOfRangeException

index < 0.

-or-

count < 0.

ArgumentExceptionindex + count > ArrayList.Count of the current instance.

Remarks

The enumerator only enumerates over the range of the current instance from index to index + count - 1. If the current instance is modified while an enumeration is in progress, a call to IEnumerator.MoveNext or IEnumerator.Reset will throw InvalidOperationException .

Note: For detailed information regarding the use of an enumerator, see IEnumerator.

Operation
As described above.

The enumerator is initially placed just before the element at position index in the current instance. A call to IEnumerator.Reset returns the enumerator to this position.

If the elements of the current instance have not been modified while the enumeration was in progress, a call to IEnumerator.MoveNext either returns true and advances the enumerator one element in the current instance, or returns false indicating the enumerator is at the end of the specified range.

Requirements

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