In this example, I\'m attempting to pass by value, but the reference is passed instead.
for (int i = 0; i < 10; i++) { Thread t = new Thread(() =>
It happens because of the way C# passes parameters to a lambda. It wraps the variable access in a class which is created during compilation, and exposes it as a field to the lambda body.