Making foreach on an IEnumerable allocation-free using reflection and dynamic methods
Read OriginalThis technical article details a method for making foreach loops on IEnumerable<T> allocation-free in C#. It explains the performance difference between iterating over a concrete List<T> and an IEnumerable<T>, demonstrates the issue with benchmarks, and introduces an advanced solution using reflection and dynamic methods to avoid boxing and interface dispatch overhead.
Comments
No comments yet
Be the first to share your thoughts!
Browser Extension
Get instant access to AllDevBlogs from your browser