Monday, May 3, 2004

Enumerating array using for vs. foreach

Enumerating array using for vs. foreach

Here's an interesting tidbit over on Brad Abram's blog about the difference between for and foreach when iterating over an array. Apparently the C# compiler just code-gens an equivalent for statement when using foreach on an array. Something we'll need to keep in mind when/if foreach makes it into a "future" release of Delphi for .NET.