Why is the code below not 333 not 012? I think the code is so simple, and I check and check and double check, triple check, until I can get an answer. Can anybody help me?
Action[] tmp = new Action[3];
for (int i = 0; i < tmp.Length; i++)
{
tmp[i] = () => Console.WriteLine(i);
}
Array.ForEach(tmp, m => m());
Console.Read();
user3596931
source
share