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
).
Here are some references ( 1 , 2 , 3 ) similar to my question.
尝试这个:
list1.RemoveAll(list => list2.Contains(list));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.