Possible Duplicate:
Why does one often see “null != variable” instead of “variable != null” in C#?
This is more a curiosity question, is there any performance difference between the statement.
if(value == null)
and
if(null == value)
is it noticeable, I use c#, PHP & javascript quite often and I remember someone saying if(null == value) was faster, but is it really?
I will soon be starting development on an application that will parse huge quantities of data in the region of Terabytes so even if the performance gain is in the millisecond range it could have an impact. Anyone have any ideas?
I doubt that there’s a measurable performance advantage either way. I’ll bet the person who told you this didn’t have any hard data.
As far as I know, it’s a historical artifact, a technique from C and C++ to guard against this mistake:
The compiler will catch this if you reverse the arguments, since you can’t assign something to null.