How do you group by multiple columns in LINQ TO SQL?
db.Table.GroupBy(a => a.column1.ToString() + a.column2.ToString())
It seems ugly and with poor performance, and I don't even know if it works. Which is the right way to do it?
How do you group by multiple columns in LINQ TO SQL?
db.Table.GroupBy(a => a.column1.ToString() + a.column2.ToString())
It seems ugly and with poor performance, and I don't even know if it works. Which is the right way to do it?
try grouping by an anonymous type:
group by new { item.Col1, item.Col2 }
you'll then be able to access Key.Col1, etc