Return to Snippet

Revision: 39723
at January 20, 2011 04:31 by housecor


Initial Code
from c in dc.Customers    
    where !(from o in dc.Orders    
            select o.CustomerID)    
           .Contains(c.CustomerID)    
    select c;

Initial URL
http://stackoverflow.com/questions/183791/how-would-you-do-a-not-in-query-with-linq

Initial Description
Note that .Except is a great option too, but only if you're dealing with a list of value types (it doesn't work with complex types unless you implement an iEqualityOperator)

Initial Title
LINQ not in statement

Initial Tags


Initial Language
C#