C# Custom Enumerators Made Simple with the Yield Keyword
An enumerator enables you to iterate over a collection in a foreach loop. You can use foreach to iterate over all C# collection classes, because all C# collection classes inherit from the IEnumerable interface (regular or generic). IEnumerable contains the GetEnumerator method, which returns an enumerator. Occasionally you may find a need to create a Related posts: Convert Between Generic IEnumerable<T> Convert Generic ICollection<T> Multiple Generic IEnumerable<T>














