compiler construction - Why isn't there "is not" keyword in c#? -


it makes sense check if object not type of x, need instead:

 if(this.gettype() != typeof(x))   {       //do thing.   } 

which bit cumbersome opinion, not nicer:

 if(this not x)   {      //do thing  } 

how logical not operator !, fits description of word 'not' fine:

if (!(this x))  {     //do thing } 

as others have pointed out though, is used check if object's class inherits class or implements interface, rather different gettype().

both codeinchaos , striplingwarrior have reasonable explanations why there isn't not keyword in c#.


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

400 Bad Request on Apache/PHP AddHandler wrapper -

php - Change action and image src url's with jQuery -