c# - Linq List comparing and exclusion -


I have two IQueryable & lt; & Gt; is the list. Say that one class is full of objects bottle and the other type is cup .

There is a code in both classes, which is DrinkID .

How do I list my bottle and find all the items in the cup list DrinkID this bottle Not in the list?

I am searching for something like this:

  var bottles = _context.AllBottles; Var cup = _context.AllCups.Where (cup => cup.DrinkID not in bottles. Drink id);  

I am using Linq for the unit

  cup Where (c => Bottles. Any (b => gt; drinkID == b.DrinkID))  

Comments