I have a database table called Investigation. Within this table there is a column called INV. This column can hold a value of 0, 1, or null.
In my application, there is an if statement written like this:
QNet.Investigation.DataContracts.Investigation investigation = Session["InvestigationObj"] as QNet.Investigation.DataContracts.Investigation;
if (investigation != null && investigation.INV != null && investigation.INV == true)
{
....
}
It seems to me that this is a bit of overkill because if investigation.INV == true then obviously the other two statements will not be null. If either of the other two are null then investigation.INV would also be null.
Am I missing something here? Is there a reason why the original developer created the if statement this way? Wouldn't
if(investigation.INV == true)
{
...
}
do the exact same thing?
Aucun commentaire:
Enregistrer un commentaire