LINQ to DataSet, distinct by multiple columns
Just wanted to check if there is way to do distinct by multiple columns. Thanks in advance!!! BTW, I found a great LINQ extension here but need some guidance to use it for multiple columns Well, you can do the projection first: var qry = db.Customers.Select(cust => new {cust.ID, cust.Name, cust.Region}) .Distinct(); Or in query syntax: var qry = (from cust in db.Customers select new {cust.ID, cust.Name, cust.Region}).Distinct(); That do? Pradeep Instead of Distinct you can use Groupby and then selecting the Top Most record of each group How to LINQ Distinct by Multiple Fields without anonymous