Home > Software design >  select an item for each itemsList in a List
select an item for each itemsList in a List

Time:11-07

I have an orders List like : <Id,Date,List> Now I want to group the List By product Id from that list But I didn't found a way to write

  from vente in OrdersList
                group products by OrdersList.Product.Id

CodePudding user response:

You want to group by the property of vente not by the list itself:

var query = from vente in OrdersList
            group vente by vente.Product.Id into productGroup
            select ...
  • Related