在Linq队列中使用IN关键字
问题描述:
如何在Linq Queue中使用IN关键字?
赞
select * from tablename
其中columnname in(1,2,3,4)
但在Linq Queue中,使用IN关键字的语法是什么?
How to use IN keyword in Linq Queue?
Like
select * from tablename
where columnname in (1,2,3,4)
but in Linq Queue, What is the syntax of using IN keyword?
答
使用包含:
Use Contains:
List<int> list = new List<int>();
var x = from n in list where new int[] {1, 2, 3, 4}.Contains(n) select n;
(不是一个完美的例子,但它应该给你一个想法)
(not a perfect example, but it should give you the idea)