mercredi 28 décembre 2016

How do I correctly use a bool with an if statement?

I have this method called "DoStuff()" and what it does it that it checks if the checkboxes are checked and if they are then do something.

    private void DoStuff()
    {
      if(Checkbox1.isChecked == true)
        {
          DoSomething();
        }

      if(Checkbox2.isChecked == true)
        {
          DoSomething();
        }

      if(Checkbox3.isChecked == true)
        {
          DoSomething();
        }

    }

How do I correctly set a bool so I dont have to do "== true" to every if statement?

Aucun commentaire:

Enregistrer un commentaire