10:00
2026-01-20
andrewlock.net
developer-tools
Making foreach on an IEnumerable allocation-free using reflection and dynamic methods
The article explains that when using `foreach` on an `IEnumerable<T>` variable instead of a concrete type like `List<T>`, the C# compiler generates code that allocates heap memory for the enumerator, โฆ