Iterator
The Iterator pattern lets code walk through a collection without knowing how it's stored. In C#, foreach works on anything that implements IEnumerable<T>, which hands out an IEnumerator<T> with MoveNext and Current. Write one by hand to see how it works, then let yield return write it for you.
Updated

- Category
- C#
- Level
- Journeyman
- Tags
- c-sharp, IEnumerable<T>, IEnumerator<T>, Iterator (c-sharp), OOP, Yield Return