且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在linq quary中使用sql quary

更新时间:2023-10-06 10:57:40

看看这个:

http://msdn.microsoft.com/en-us/data/jj592907.aspx [ ^ ]


IN运算符可以通过'使用'来实现包含'

以下示例

IN operator can be achieved by using 'Contains'
Sample below
List<int> input = new List<int>() { 8, 11, 18, 26, 1, 14, 17, 25, 27, 30, 5, 6, 7, 20, 21, 22, 12, 13, 19, 24 };

List<int> source = new List<int>() { 8, 11, 18, 26, 1, 14, 17, 25, 27, 30, 5, 6, 7, 20, 21, 22, 12, 13, 19, 24 };

 var acoTransaction = source.Where(p => input.Contains(p) ).ToList();