meysamh66
4/28/2018 - 6:57 PM

Group by in LINQ

var results = persons.GroupBy(
    p => p.PersonId, 
    p => p.car,
    (key, g) => new { PersonId = key, Cars = g.ToList() });