Login
Roast topics
Find topics
Find it!
From:
Fabulous adventures in coding
(Uncensored)
subscribe
Closing over the loop variable considered harmful, part one | Fabulous adventures in coding
https://ericlippert.com/2009/11/12/closing-over-the-loop-variable-considered-harmful-part-one/
links
backlinks
Roast topics
Find topics
Roast it!
UPDATE: We are taking the breaking change. In C# 5, the loop variable of a foreach will be logically inside the loop, and therefore closures will close over a fresh copy of the variable each time. …