Has foreach’s use of variables been changed in C# 5?
This is a change to the C# language, not the .NET framework. Therefore, it only affects code compiled under C# 5.0, regardless of the .NET framework version on which that code will execute. C# 5.0 Section 8.8.4 of the specification makes it clear that this change has been made. Specifically, page 249 of the C# … Read more