Wednesday May 4th

Tuesday May 3rd

Monday May 2nd

Performance of foreach vs. List.ForEach

Today I was iterating a List<int> using a foreach-loop and feeling a bit smug in knowing how much more performance-conscious I was being than if I'd tried doing the same thing with an ArrayList filled with ints. Thanks to the wonder of generics, the C# compiler neatly avoids numerous boxing operations by using a System.Collections.Generic.IEnumerator<int> instance instead of the older System.Collections.IEnumerator. Then I got to thinking: "is this really the fastest way?" Upon investigation, it turns that, no, it isn't the fastest way.


Yeah, i did something like that. you can see it's results here:
In this article the point was not boxing and unboxing but what was important to me was .ForEach extension method structure.
i will be very glad if i see your comments on my test.;)

Commenting on Stories is limited for now and will open up to those recommended by the community. Learn how
Loading DotNetKicks...
brought to you by the Kicks Network