Is there anyway to implement a not !
operator in C# when using is
keyword , for example if I have a class named Model
, I can check in a list of Items for what items are of type Model
similar to Items.Where(x => x is Model)
but what if I want to check for the items in the list that are NOT of type Model
?
Is there anyway to implement something like this,
Items.Where(x => x is ! Model)
or Items.Where(x => x isNot Model)
one work around I found is
Items.Where(x => x.GetType().Name != "Model")
but is there any better way to implement this ?