using System.Collections.Generic;
public List<string> Cars;
public static void Main()
List<Person> persons = new List<Person>()
new Person { PersonId = 1, car = "Ferrari" },
new Person { PersonId = 1, car = "BMW" },
new Person { PersonId = 2, car = "Audi"}
List<Result> results1 = (
group p by p.PersonId into g
Cars = g.Select(c => c.car).ToList()
foreach (Result item in results1)
Console.WriteLine(item.PersonId);
foreach(string car in item.Cars)
Console.WriteLine("-----------");
List<Result> results2 = persons
.GroupBy(p => p.PersonId,
Cars = c.Select(cs => cs.car).ToList()
foreach (Result item in results2)
Console.WriteLine(item.PersonId);
foreach(string car in item.Cars)