IEnumerable
suggest changeIntroduction
IEnumerable is the base interface for non-generic collections that can be enumerated, such as ArrayList. IEnumerable<T> is the generic counterpart, implemented by List<T> and similar collections. IEnumerator and IEnumerator<T> are the enumerators those collections return, not the collections themselves.
IEnumerable declares GetEnumerator. That method returns an IEnumerator, which foreach uses to walk the collection.
Remarks
Generic collections use IEnumerable<T>. Their GetEnumerator method returns an IEnumerator<T>.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents