The enumerator enables very simple ForEach style enumeration. It is not guaranteed that two Enumerators taken from the same collection at the same time will result in the same iteration.
Enumerators iterate over the members of a collection. They represent a logical snapshot of the collection data items. Items added or removed from the underlying collection may have no effect or may put the enumerator in an invalid state.
When an enumerator is started the current position is before the first element in the collection. Therefore, calling Current is invalid and results in an InvalidOperationException being thrown.
MoveNext will return true until it has reached the end of the collection. It will then return false for each successive call. However once MoveNext has returned false, accessing the Current property will throw an InvalidOperationException.
Reset returns the enumerator to the position it started from. Multiple calls to Reset() must result in logically the same state for the enumerator. This may take a new snap-shot from the collection or simply reset to the start of this collection.
public interface IEnumerator { bool MoveNext (); object Current {get;} void Reset (); }