Possible Duplicate:
How can I implement NotOfType<T> in LINQ that has a nice calling syntax?
I have a collection where I want to iterate over all objects that are not of type Foo
. Basically I'd like something opposite of OfType<Foo>()
. What would be the appropriate way to do this?
So far I've used:
var result = myList.Where(elem => !(elem is Foo));