Deane Deane - 1 year ago 63
C# Question

What's the opposite of "is"?

if(myVariable is SomeType)


Out of nothing but curiosity, what's the opposite of that? I want to do something like:

if(!myVariable is SomeType)
if(myVariable is not SomeType)


Neither compile.

Given that "is" is a non-searchable word in most engines, this has been a hard one to find an answer to.


Duplicate:

C# : ‘is’ keyword and checking for Not

Answer Source

Try

if (!(myVariable is SomeType))