Type Reason InvalidOperationException The collection was modified after the enumerator was instantiated.
An enumerator remains valid as long as the collection remains unchanged. If changes are made to the collection, such as adding, modifying, or deleting elements, the enumerator is irrecoverably invalidated and the next call to the IEnumerator.MoveNext or IEnumerator.Reset method throws an InvalidOperationException.
The IEnumerator.Reset method is provided for COM interoperability. It does not necessarily need to be implemented; instead, the implementer can simply throw a NotSupportedException.