Imagine this case where I have an object that I need to check a property. However, the object can currently have a null value.
How can I check these two conditions in a single "if" condition?
Currently, I have to do something like this:
if (myObject != null)
{
if (myObject.Id != pId)
{
myObject.Id = pId;
myObject.Order = pOrder;
}
}
I would like something like this:
if (myObject != null && myObject.Id != pId)
I want to evaluate the second condition only if the first was true.
Maybe I'm missing something, and that's why I need your help ;-)