How is foreach implemented in C#? [duplicate]
It doesn’t use an anonymous function, no. Basically the compiler converts the code into something broadly equivalent to the while loop you’ve shown here. foreach isn’t a function call – it’s built-into the language itself, just like for loops and while loops. There’s no need for it to return anything or “take” a function of … Read more