LINQ not in statement


/ Published in: C#
Save to your folder(s)

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)


Copy this code and paste it in your HTML
  1. from c in dc.Customers
  2. where !(from o in dc.Orders
  3. select o.CustomerID)
  4. .Contains(c.CustomerID)
  5. select c;

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.