在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)
也可以正常工作。
Trylist.where(x=> x.id == (List2.where(y=>List2.contains(value).first().id);
Herevalue
is what you are trying to find inlist2
.
Though if you know the id that you want to search for, thenlist.where(x => x.id == value)
is going to work as well.