在where子句中的列表中搜索id [英] search for id in list in where clause

查看:62
本文介绍了在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.


这篇关于在where子句中的列表中搜索id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆