AND is better or using Internal "IF"

Posted by BDotA on Programmers See other posts from Programmers or by BDotA
Published on 2012-10-29T22:05:46Z Indexed on 2012/10/29 23:19 UTC
Read the original article Hit count: 227

Filed under:
|

In a situation like this:"

if ((metadata != null) && (metadata.TypeEnum != VariantInfoMetadata.CellTypeEnum.Status))

do you recommend to keep the code as it is above or do you think it is better to make an internal "if" statement and brake that AND into two sections where "outer if" makes sure metadata is not null and inner if does the rest of the checking. I think this way will take care of possible null refrence exception if value of metadata gets null?

© Programmers or respective owner

Related posts about null

Related posts about logic-programming