Is it safe to check an object for null and in the same if-statement compare the object's property value?

Viewed 2743

See thread title. Can I safely do something like that without worrying about a NullReferenceException, or is not guaranteed that those boolean expressions will be evaluated left to right?

// can this throw an NRE?
if (obj == null || obj.property == value)
{
   // do something
}
3 Answers
Related