Enumerations in C# with IEnumerable & IEnumerator — explained

Stefan Schranz
3 min readMar 30, 2021

C#, just like a lot of modern programming languages, makes it very easy to iterate collections. But how exactly do these parts work under the hood?

First, let’s see a short example:

public static void Main()
{
var simpleList = new List<String>(){ "Hello", "to", "Medium" };
foreach (var item in…

--

--

Stefan Schranz

26 year old full stack software developer from Germany - Enthusiatic about C#, .Net and Cloud — Visit me at https://dotschranz.net/