Skip to content

Instantly share code, notes, and snippets.

@plioi
Created March 7, 2012 00:19
Show Gist options
  • Save plioi/1990055 to your computer and use it in GitHub Desktop.
Save plioi/1990055 to your computer and use it in GitHub Desktop.
var delayedGreetings = new List<Func<string>>();
foreach (var name in new[] { "Larry", "Moe", "Curly" })
delayedGreetings.Add(() => "Hello, " + name + "!");
//Some time later...
foreach (var greeting in delayedGreetings)
Console.WriteLine(greeting());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment