4 ms·
After I wrote my reply I played around with some C# and found to my surprise that foreach does in fact provide a new variable to be captured on each iteration,
by singular 13y ago
After I wrote my reply I played around with some C# and found to my surprise that foreach does in fact provide a new variable to be captured on each iteration, so clearly this is a design decision that varies between languages.