When implemented by a class, advances the enumerator to the next element of the collection.
[Visual Basic] Function MoveNext() As Boolean [C#] bool MoveNext(); [C++] bool MoveNext() = 0; [JScript] function MoveNext() : Boolean;
true if the enumerator was successfully advanced to the next element.
false if the enumerator has passed the end of the collection.
Exception Type | Condition |
---|---|
InvalidOperationException | The collection was modified after the enumerator was instantiated. |
After an enumerator is created or after a Reset, an enumerator is conceptually positioned before the first element of the collection, and the first call to MoveNext moves the enumerator over the first element of the collection.
If elements are added, removed or repositioned in the collection after this enumerator was created, MoveNext may throw an exception.
Once the end of the collection is passed, subsequent calls to MoveNext will return false until Reset is called.
IEnumerator Interface | IEnumerator Members | System.Collections Namespace | Current | Reset