How to perform group by in LINQ and get a Iqueryable or a Custom Class Object?

Posted by VJ on Stack Overflow See other posts from Stack Overflow or by VJ
Published on 2010-05-14T20:02:01Z Indexed on 2010/05/14 20:04 UTC
Read the original article Hit count: 320

Filed under:
|
|
|

Here is my query -

var data = Goaldata.GroupBy(c => c.GoalId).ToList();

This returns a Igrouping object and I want an Iqueryable object which I can directly query to get the data while in this case I have to loop through using a foreach() and then get the data. Is there another way to group by in LINQ which returns directly a list of Iqueryable or the a List as similar to what happens for order by in LINQ.

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about c#