question : can we made groupby to multiple fields in LINQ
Currently – i have linq something like this
q = q.GroupBy(c => c.Id)
.Select(g => new View
{
Id = g.Key,
ENAME= string.Join(",", g.Select(x => x.CaseApprover).ToList())
});
i wanted to group by with multiple fields something like
q = q.GroupBy(c => c.Id, c.name,c.age,c.dob)
also how to put them in select query? such that i will get the newly added fields in select query also.
Try this:
This will return an anonymous type, if you want these fields in your
Viewclass, just add them.