csharp linq unique by property

Code Example - csharp linq unique by property

                
                        List<Person> distinctPeople = allPeople
   .GroupBy(p => p.PersonId)
   .Select(g => g.FirstOrDefault())
   .ToList();