我有一个LINQ问题,我试图解决,我有一些用户可以成为多个组的一部分,现在我能够返回哪些用户属于一个组,如下所示:LINQ查询常见关联
List<Student> students = new List<Student>();
public List<Student> ReturnStudentByGroupName(string groupName)
{
List<Student> student = (from g in students
where
(from t in g.StudentGroup where t.GroupName == groupName select t).Count() > 0
select g).ToList();
return student;
}
我现在的问题是我需要找到多个组的普通用户吗?例如,谁是A组和B组的普通成员。我不在寻找这两个组的用户列表,它应该只返回用户如果他们属于这两个组。
有谁知道如何做到这一点使用两个字符串作为输入,即字符串firstgroupName,字符串secondgroupName。然后返回普通学生?
认真做到了吗? – 2012-04-22 06:45:17
@JungleBoogie:是的,特别是现在我刚修好了。 – caesay 2012-04-22 06:48:08
哈哈是啊我注意到了字符串也好,只是要试一试,并提前接受我的道歉。 – 2012-04-22 06:50:30