0
比较我必须做一些过滤的泛型集合。我正在尝试使用LINQ。这是我的代码:过滤泛型集合,而与另一个集合
from student in students
where student.ID == (Here is another collection) from newstudent in Newstudents
select newstudent.ID
select student
我不知道如何比较int集合与单个int。请告诉我一个很好的方法来做到这一点。
那么你试图执行什么样的比较?你们是不是要找到所有的学生与集合中的ID?如果是这样,你可以使用“Contains”,例如'那里ids.Contains(student.ID)'...或者你可以使用一个加入反对集合。 –
你一个也用加入了这一点,如果你有两个收集 –
我如何使用包含。我无法。我更新了代码。请再看看我正在尝试做什么 – user134235