title: IF Statement multiple conditions, same statement
body: <p>Hey all, looking to reduce the code on my c# if statements as there are several repeating factors and was wondering if a trimmer solution is possible.</p>
  
  <p>I currently have 2 if statements that need to carry out an identical statement, however the only variable is an extra condition on an if statement when a checkbox is not checked. Im just wondering if there is a way to make it one statement or make the condition string variable, heres the compressed version of the code:</p>
  
  <pre><code>if (checkbox.checked)
    {
      if (columnname != a &amp;&amp; columnname != b &amp;&amp; columnname != c)
      {
        "statement 1"
      }
    }
  else
    {
      if (columnname != a &amp;&amp; columnname != b &amp;&amp; columnname != c 
          &amp;&amp; columnname != A2)
      {
        "statement 1"
      }
    }
  </code></pre>
  
  <p>Its like I need to run an if statement within the conditions of an if statement if that makes sense, like this psuedo form:</p>
  
  <pre><code>if (columnname != a 
      &amp;&amp; columnname != b 
      &amp;&amp; columnname != c 
      &amp;&amp; if(checkbox.checked{columnname != A2})
  </code></pre>