IEnumerable and IEnumerator are two different things.
IEnumerable<T> is a sequence that can be repeated.
IEnumerator<T> is the object returned by IEnumerable<T> to repeat the sequence in sequence.
In general, the only place to return IEnumerator<T> is the GetEnumerator() method.
yield return behaves the same for both types, except that the iterator method that returns IEnumerable<T> can be executed several times (each time the sequence is enumerated).
For more information on how this works, see John Skeet's article .
SLaks source share