Linq group by query

前端 未结 2 504
遇见更好的自我
遇见更好的自我 2020-12-28 16:31

Trying to work out a linq query and was wondering if you guys could help.

I have a list of objects foo and each foo object has a list of <

2条回答
  •  感动是毒
    2020-12-28 16:53

    Looks like you want:

    var query = from foo in list
                from bar in foo.Bars
                group bar.Value by bar.Date into dates
                select new { Date = dates.Key, Sum = dates.Sum() };
    

提交回复
热议问题