I have a collection. I need to group a collection using property “A”. And I have to sort each group by property "B". Then select 5 first from each group.
Can anyone suggest a LINQ query for this?
The way I tried does not work.
(from item in Recipes
orderby item.Rating descending
group item by item.MainCategory).Take(5)
Request must return IEnumerable<IGrouping<string, myrecipetype>>
source
share