var beatles = (new[] {
new { inst = "张三" , age="50" },
new { inst = "张三" , age="20" },
new { inst = "何英" , age="35" },
new { inst = "张三" , age="60" },
new { inst = "何英" , age="18" }
});
var o11 = from d in beatles
group d by d.inst into g
select new
{
Id = g.Max(m => m.age),
Name = g.Key
};
查询结果是:
inst = "张三" , age="60"
inst = "何英" , age="35"