samedi 27 juin 2015

.NET c# IF statement evaluates FALSE branches as TRUE

I can't wrap my head around it. I deleted the section of code and wrote it from scratch and it is still the same issue.

I read the post "If statement evaluates to false but still branches as if it was true". It has not been helpful.

Immediate window check:

action == null false

action

{ReadSomeObject} [B.Q.E.ReadAction]: {SomeObject} Exceptions: {B.Q.E.ExceptionCollection} Id: "ReadSomeObject" IsSomething: false IsSomethingElse: false*

Code:

if(action.Equals(null)) //or also tried if(action == null)
{
    throw ExceptionManager.CreateArgumentNullException("action");
}//Where 'action' is an object

Any suggestions and thoughts would be appreciated. Thank you

Aucun commentaire:

Enregistrer un commentaire