Skip to content

Instantly share code, notes, and snippets.

@fffej
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fffej/791cf604e8feada28439 to your computer and use it in GitHub Desktop.
Save fffej/791cf604e8feada28439 to your computer and use it in GitHub Desktop.
var foos = new List<int>{1,2,3,4};
var bars = new List<int>();
foreach(var foo in foos) {
Console.WriteLine("hello");
bars.Add(x*2);
}
// versus.
var bars = foos.Select(x => {Console.WriteLine("hello"); return x*2;});
Console.WriteLine("goodbye");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment