10
在LINQ中分组
假设我们有一个类似的类: class Person { internal int PersonID; internal string car; } 现在,我有一个此类的清单: List<Person> persons; 现在,此列表可以包含多个具有相同PersonID的实例,例如: persons[0] = new Person { PersonID = 1, car = "Ferrari" }; persons[1] = new Person { PersonID = 1, car = "BMW" }; persons[2] = new Person { PersonID = 2, car = "Audi" …