[英] What is the linq equivalent to the SQL IN operator
使用linq,我必须判断数组中是否存在行的值
WHERE ID IN (2,3,4,5)
我该怎么做?
使用linq,我必须判断数组中是否存在行的值
WHERE ID IN (2,3,4,5)
我该怎么做?
.包含
var resultset = from x in collection where new[] {2,3,4,5}.包含(x) select x
当然,对于你的简单问题,你可能会遇到如下情况:
var resultset = from x in collection where x >= 2 && x <= 5 select x