Sqlserver查询方式翻译为Linq
select * from sys_Tree where id in (1,2,3)
这样的查询语句在linq中怎样写那!
[解决办法]
int[] intArray = new int [] { 1, 2, 3 };var result = from c in sys_Tree where intArray .Contains(c.id) select c;
[解决办法]
int[] intArray = new int [] { 1, 2, 3 };
var result = from c in sys_Tree
where intArray .Contains(c.id)
select c;
[解决办法]
var result = from c in sys_Tree
where new int[]{ 1, 2, 3 }.Contains(c.id)
select c;
OR:
var result =sys_Tree.Where(c=>int[]{ 1, 2, 3 }.Contains(c.id));
[解决办法]
用ls的第二种lambda表达式,看起来舒服
[解决办法]
http://blog.csdn.net/q107770540/article/details/5387946
[解决办法]
from u in sys_Tree
where u.id.Contains(1,2,3)
select u
[解决办法]
弱弱的表达下,至今我都不懂什么是lambda表达式,但我写的linq跟楼上所写的一样,不知道是也不是