14/03/2014

Play with LINQ in CRM - How to Subtract ListA from ListB

Suppose we have two LINQ query result sets ListA and ListB and both have a field called ContactId and we want to get records in ListA which does not exists in ListB:

Here is the Code:

ListA.RemoveAll(x => ListB.Exists(temp => temp.ContactId == x.ContactId));

No comments:

Post a Comment