我有一個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