Could any one explain what is going on in the below code? Why is nothing getting printed?
var actions = new Action[100];
for(int i=0;i<100;i++)
{
actions[i] = () => DoSomething(i);
}
foreach(var action in actions)
{
action();
}
void DoSomething(int i)
{
if(i % 9 == 0)
Console.WriteLine("{0} is a multiple of 9",i);
}