The discussion about the preference difference between FOREACH and FOR is not new. We all know that FOREACH is slower, but not all know why.
When I started learning .NET, one person told me that FOREACH is two times slower than FOR. He said this without any grounds. I took it for granted.
Eventually, I decided to explore the performance of both loops, and write this article to discuss nuances. (more…)