Back to "Getting involved in dumb arguments...of when 'for' and 'foreach' can lead to idiocy..."

This is a viewer only at the moment see the article on how this works.

To update the preview hit Ctrl-Alt-R (or ⌘-Alt-R on Mac) or Enter to refresh. The Save icon lets you save the markdown file to disk

This is a preview from the server running through my markdig pipeline

C# Imported mostlylucidcouk Performance

Getting involved in dumb arguments...of when 'for' and 'foreach' can lead to idiocy...

Sunday, 29 February 2004

I do have a tendency to get involved in pointless arguments in the ASP.NET Forums...a good example is this one, arguing about the performance of 'foreach' versus 'for'...any opinions from here - the crux of my argument is that for() will in general perform better than foreach() - because the generated IL simply does far less in most cases (I am aware of some optimisations which reduce the benefit for very simple collections).

logo

© 2025 Scott Galloway — Unlicense — All content and source code on this site is free to use, copy, modify, and sell.