I\'m stuck with a LINQ query (or any other efficient means of accomplishing the same thing). Can someone show me how I can select all the items in one list that are not pre
Try using .Except
extension method (docs):
var result = list1.Except(list2);
will give you all items in list1
that are not in list2
.
The easiest way is to use the Except
method.
var deletedItems = list1.Except(joinItems);
This will return the set of items in list1
that's not contained in joinItems
Try this:
var List2 = OriginalList.Where(item => !List1.Any(item2 => item2.ID == item.ID));