It just makes sense sometimes to check if an object is not type of X, so you need to do this instead:
if(this.GetType() != typeof(X))
{
//Do my thing.
}
Which is a bit cumbersome to my opinion, would not something like this be nicer:
if(this is not X)
{
//Do my thing
}
How about the logical NOT operator
!, fits the description of the word ‘not’ just fine:As others have pointed out though,
isis also used to check if an object’s class inherits from some class or implements some interface, which is rather different fromGetType().Both CodeInChaos and StriplingWarrior have reasonable explanations for why there isn’t a
notkeyword in C#.