How do I create a method to return the results of a group by in LINQ to sql such as the one below:
internal SomeTypeIDontKnow GetDivisionsList(string year)
{
var divisions = from p in db.cm_SDPs
where p.acad_period == year
group p by new
{
p.Division
} into g
select new
{
g.Key.Division
};
return divisions;
}
I can't seem to define a correct return type. I think it is because it's an anonymous type but haven't got my head around it yet. Do I need to convert it to a list or something?
The results would just be used for filling a combo box.