I would like to know if its possible to remove multiple items from list based on another list without create new list instance?
I know its possible to use the except
method but it does not remove the elements from the original list like the removeAll
does, I would have happy to use the removeAll
but it does not have an overload for passing a list as parameter (only for Predicate
).
try this:
list1.RemoveAll(list => list2.Contains(list));