Skip to content

Instantly share code, notes, and snippets.

@why-jay
Created January 24, 2015 05:37
Show Gist options
  • Save why-jay/6f8d53f946f2f3b5c637 to your computer and use it in GitHub Desktop.
Save why-jay/6f8d53f946f2f3b5c637 to your computer and use it in GitHub Desktop.
List<Action> actions = new List<Action>();
for (int counter = 0; counter < 10; counter++)
{
int copy = counter; // block-scoping in action!!
actions.Add(() => Console.WriteLine(copy));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment