Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Linq to list query C#
- var values = theCollection
- .GroupBy(item => item.Name)
- .Select(g => new { Name = g.Key, Total = g.Sum(i => i.Value) });
- foreach(var value in values)
- Console.WriteLine("{0} - {1}", value.Name, value.Total);
Add Comment
Please, Sign In to add comment