How do I get items from collection A that are not in collection B? that is, AB

Possible duplicate:
Disjoint Union in LINQ

DUPE : Disjoint Union in LINQ

I know this is a simple collection operation, my code is:

var gone = from a in A
     where B.Contains(a) == false
     select a;

      

but it doesn't work.

+1


a source to share


1 answer


var gone = A.Except(B);

      



+2


a source







All Articles