Group by with multiple columns using lambda

Naor picture Naor · Aug 4, 2011 · Viewed 166.1k times · Source

How can I group by with multiple columns using lambda?

I saw examples of how to do it using linq to entities, but I am looking for lambda form.

Answer

Aducci picture Aducci · Aug 4, 2011
var query = source.GroupBy(x => new { x.Column1, x.Column2 });