题
我想根据标准减去集合。伪查询看起来像:
select table1.columnn1
,table1.column2
from table1, table2
where (table1.column1.value1 not in table2.column1
and
table1.column2.value2 not in table2.column2)
我可以在这里做到:
dim list = From tbl1 In table1 Where tt.column1 ...
从那里我不知道该怎么做。
解决方案
在LINQ中查看 Except
标准查询运算符。这产生了两个序列的集合差异。
http://msdn.microsoft.com /en-us/library/system.linq.enumerable.except.aspx
您可以使用 Contains
运算符来实现您想要的效果,如下例所示:
dim table2Col1 = from t in table2 select t.column1
dim table2Col2 = from t in table2 select t.column2
dim results = _
from t in table1 _
where not table2Col1.Contains(t.column1) _
and not table2Col2.Contains(t.column2) _
select new with { .column1=t.column1, .column2=t.column2 }
不隶属于 StackOverflow