LINQ中的左外部联接

| 我知道上面有很多帖子,但是它们都是关于特定问题的,我不知道还剩下什么,正确的什么 我有2个清单:左和右。我需要选择左侧所有不在右侧的元素。
List<T> left = GetLeft();
List<T> right = GetRight();

IEnumerable result = // Have no idea
我该怎么做呢?     
已邀请:
听起来根本不像是联接……听起来像:
var result = left.Except(right);
    
这是我找到的解决方案。 查找所有未购买的客户: SQL:
   Select c.Name from Customers c             
   Left Outer Join Purchases p on c.customerid=p.customerid 
   where p.price is null
LINQ:
   from c in Customers
   join p in Purchases on c.customerid=p.customerid into custPurchases
   from cp in custPurchases.DefaultIfEmpty()
   where cp==null
   select new
   {
   cc.Name
   }
    

要回复问题请先登录注册