List<A> a = (from p in Alist
where !(from f in Blist select f.Id).Contains(p.Id)
where !(from f in Blist select f.Id).Contains(p.Id)
select p).ToList();
查出来的sql语句为:select * from A where A.Id not in(select Id * from B)
本文介绍了一种使用C#中的LINQ进行集合操作的方法,并展示了如何将LINQ查询转换为等效的SQL语句。具体示例为从集合A中筛选出不在集合B中的元素。
996

被折叠的 条评论
为什么被折叠?



