Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# linq unique by property

List<Person> distinctPeople = allPeople
   .GroupBy(p => p.PersonId)
   .Select(g => g.FirstOrDefault())
   .ToList();
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #linq #unique #property
ADD COMMENT
Topic
Name
3+5 =