vendredi 23 janvier 2015

Using "new" and "if" statements together - syntax related

I'm doing a code review for a coworker, and I saw the following statement pop up:



if ((someClass object1 = new someClass))
{
// Do work
}


Does this statement say the same as the following?



someClass object1 = new someClass;
if (object1)
{
// Do work
}


I'm just trying to see if they are equal so we don't get any bugs.


Aucun commentaire:

Enregistrer un commentaire