System.Collections.IEnumerator

Added in .NET 1.1
supports a simple iteration over a non-generic collection
This allows you to implement a non-standard way of enumerating something, ie returning its elements one-by-one


public interface IEnumerator 
{
   object Current { get; }
   bool MoveNext();
   void Reset();
}

Current - (Property) Throws an exception if MoveNext returns false
MoveNext - (Method) sets Current to the next element. If MoveNext passes the end of the collection, the enumerator is positioned after the last element and MoveNext returns false
Reset - (Method) Sets the enumerator before the first element


Collections do not usually implement enumerators
Collections usually provide enumerators via the IEnumerable interface


System.Collections.IEnumerator<T>

Added in .NET 2.0
This inherits from IDisposable


public interface IEnumerator<T> : IEnumerator, IDisposable 
{
   T Current { get; }
}


© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext