Dumb question I get it..but what the difference between these two statements
if( null == this.someVariable)
{
//do something
}
and
if( this.someVariable == null )
{
//do something.
}
They are the same from a code point of view. Some people prefer the first style, because if you then make a mistake and type = instead of == you'll get an error
There's absolutely no difference at all. Except maybe which looks better to you.
It's a relic from the C\C++ world where:
if(null = someVariable)
{
}
Would give an error. But:
if(someVariable = null)
{
}
Would not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With