在where子句中的列表中搜索id

问题描述:

我的朋友们

我想做一些这样的事情

list.where(List2.contains(int x));

有没有办法做到这一点

请一些帮助.......

Hi my friends
I want to do some thing like this
list.where(List2.contains(int x));
is there any way to do this
please some help .......

试试 list.where(x => x.id ==(List2.where(y => List2.contains(value)。first {。。id);



这里价值是你想要在 list2 中找到的。



虽然如果您知道要搜索的ID,那么

list.where(x => x .id == value)也可以正常工作。
Try list.where(x=> x.id == (List2.where(y=>List2.contains(value).first().id);

Here value is what you are trying to find in list2.

Though if you know the id that you want to search for, then
list.where(x => x.id == value) is going to work as well.