考虑一下这个集合
List<Person> people = new List<Person> { new Person{Name = "A",SSN="1",Age = 23},new Person{Name = "A",SSN="2",new Person{Name = "B",SSN="3",Age = 24},new Person{Name = "C",SSN="4",new Person{Name = "D",SSN="5",Age = 23} };
问题是:如何编写LINQ查询以对Age on Person进行分组,然后计算具有相同名称的每个组中的人数?
我尝试使用group by运算符,嵌套查询所有可能性仍然无法弄清楚确切的查询.
问候,
哎呀