There is a list of a class in my software with these properties :
Name — Quantity
list may contains these data :
name1 — 12
name1 — 10
name2 — 10
name2 — 5
I need a output like this :
name1 — 22
name2 — 15
I can make this output with messy code (with for each and etc) but how can I provide this with LINQ query ?
There is a list of a class in my software with these properties :
Share
You can use Enumerable.GroupBy and Enumerable.Sum.
It would look similar to: