Select from following answers:- from p in products group p by p.Category into g select new { g.Key, g };

- from p in from g in products select g.Category select p;
- from p in products group p by p.Category into g select g.Key;
- All Above
Use the group by operator to create a LINQ query to return an object than contains each unique category name along with a list of all products in that category. Specify a return type that includes the grouping Key (Category in this case) and the entities in the group.
This query's return type is g.Key. This will return just a list of category names, without the associated products:
from p in products
group p by p.Category
into g select g.Key;
Show Correct Answer
Source: MeasureUp.Com | |
Alert Moderator