Linq集团有

时间:2010-10-05 09:45:14

标签: .net linq

我是linq的新手,我想要的是在tqsl中做同组。 我的班级:

class test{
public int field1;
public int field2;
public int field3;
}

现在我有:

IEnumerable<test> list;

我想要类似的东西:

IEnumerable<test> q=
from p
in list
group p by p.field1
having p.field2==p.field2.Max()
select p;
你帮我吗?

1 个答案:

答案 0 :(得分:0)

只需使用where-keyword,LINQ就会为你排序。

编辑: Some nice examples on the use of LINQ