Mid LINQ

How to get distinct by multiple properties?

How to get distinct by multiple properties?

var distinctByDeptAndSalary = employees

.GroupBy(e => new { e.Department, e.Salary })

.Select(g => g.First());

More from LINQ Tutorial

All questions for this course