To test if an object is of a certain type then we write if ( myObject is SomeClassName )
But how do we write if I want to test that the object is not of the mentionned type ?
To test if an object is of a certain type then we write if ( myObject is SomeClassName )
But how do we write if I want to test that the object is not of the mentionned type ?
There isn't one, you have to wrap it in a ! operator:
if (!(myObject is SomeClassName))
if (!(myObject is SomeClassName))
Is probably the cleanest way of checking not is. Just checks if it is the type of object then flips it.