I was just writing an if statement with fairly long property names and came occross this problem.
Let say we have an if statement like this:
if(_someViewModelNameThatIsLong.AnotherPropertyINeedToCheck == someValue &&
!_someViewModelNameThatIsLong.ThisIsABooleanPropertyThatIsImportant)
{
//Do something
}
The second property is of a boolean type and it makes no sense to have the stetement like
if(boleanValue == true)
Is there a better way to emphasize the negation then to put the !
in front. To me it seems like this can easily be overseen when reading the code and may potentialy cause problems with debuging
_someViewModelNameThatIsLong
– MattDavey Jan 21 '13 at 11:51if( ! something)
vsif(!something)
– Svish Jan 21 '13 at 14:44... && model.Prop == false)
? Personally I very rarely use!
, it's too easy to overlook. – Jan 21 '13 at 17:49