LINQ foreach iteration variable capturing and how it’s fixed in Visual