Guest User

Untitled

a guest
Aug 17th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. Linq to list query C#
  2. var values = theCollection
  3. .GroupBy(item => item.Name)
  4. .Select(g => new { Name = g.Key, Total = g.Sum(i => i.Value) });
  5.  
  6. foreach(var value in values)
  7. Console.WriteLine("{0} - {1}", value.Name, value.Total);
Add Comment
Please, Sign In to add comment