I have this long if statement that is checking for multiple things. It never seems to execute the code in the curly brackets though.
It is checking two objects.
"currentEngineObject" is the object as it exists in the database.
"engineList" is the object that is passed into this method.
So I am trying to check to make sure that the SizeId is not empty and also has a value for both objects.
If they both have values, but they are not the same value, I want to set the "SizeId" of engineList to the "SizeId" value that is in "currentEngineObject".
But even with test data, it never gets through the large if statement I have.
So I am wondering if there is a problem with my logic? Like should I be using "Or" instead of "And"?
Here is my if block:
if ((currentEngineObject.SizeId.HasValue
&& currentEngineObject.SizeId.Value != Guid.Empty)
&& (engineList.SizeId.HasValue
&& engineList.SizeId.Value != Guid.Empty)
&& (currentEngineObject.SizeId.Value != engineList.SizeId.Value))
{
engineList.SizeId = currentEngineObject.SizeId.Value;
}
Thanks!
Aucun commentaire:
Enregistrer un commentaire