LINQ Distinct Operator
Posted: Wed 20 May 2009 13:54
I have a Linq query and I want to remove duplicate entries based on a certain field
I would like to remove entries with duplicate personIds (p.Id).
How can i achieve this in VB?
Code: Select all
persons = From p In db.Persons, a In db.Addresses _
Where p.Id = a.PersonId _
Order By p.Id _
Select New With {p.EmailAddress, p.LastName, p.FirstName, a.Id, a.Phone1, _
.PersonId = p.Id, .Department = p.Department.Name, p.Title}
How can i achieve this in VB?