title: Uncheck all checkBoxes with C#
body: <p>I am trying to write a code which will uncheck all checkBoxes in my form when a button is clicked. I know that I could do</p>
  
  <pre><code>checkBox1.Checked = false;
  checkBox2.Checked = false;
  checkBox3.Checked = false;
  </code></pre>
  
  <p>and so on, but I have about 35 checkBoxes, so I was hoping to use a simpler code. I keep finding stuff online that looks like this;</p>
  
  <pre><code>foreach (Control cBox in this.Controls)
  {
      if (cBox is CheckBox)
      {
          ((CheckBox)cBox).Checked = false;
      }
  }
  </code></pre>
  
  <p>And I was hoping to use something like that, instead of writing <code>checkBox1.Checked = false;</code> about 70 times (because I have 2 buttons, both of which need to do various things and then uncheck all the boxes.</p>
  
  <p>I saw another solution that involved a Stack Panel or some type of code that looked more like Javascript or HTML than C#, and also seemed to involved writing out each checkBox.Checked status as its own line, which doesn't save me any lines of code. </p>
  
  <p>Any tips would be appreciated. Thanks all :)</p>