Skip to content

Instantly share code, notes, and snippets.

@hagbarddenstore
Created November 12, 2013 23:24
Show Gist options
  • Save hagbarddenstore/7440684 to your computer and use it in GitHub Desktop.
Save hagbarddenstore/7440684 to your computer and use it in GitHub Desktop.
void Main()
{
var list = new List<int> { 1, 2, 3, 4, 5, 6 };
var sumOfAllItems = list.Sum(_ => Print(_));
Console.WriteLine(sumOfAllItems);
}
static int Print<T>(T item)
{
var s = item.ToString();
Console.WriteLine(s);
return s.Length;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment