在Linq队列中使用IN关键字 [英] Use IN Keyword in Linq Queue

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


这篇关于在Linq队列中使用IN关键字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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