I want to do something like this:
List<SomeClass> list1 = ...
List<SomeClass> list2 = ...
Predicate<SomeClass> condition = ...
...
list2.RemoveAll (!condition);
...
list2.AddRange (list1.FindAll (condition));
However, this results in a compiler error, as !
can't be applied to Predicate<SomeClass>
. Is there any way to do this?