Ilef jlassi
Ilef jlassi

Reputation: 35

select an item for each itemsList in a List

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

Upvotes: 1

Views: 41

Answers (1)

Tim Schmelter
Tim Schmelter

Reputation: 460158

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 ...

Upvotes: 1

Related Questions