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.
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:
if (checkbox.checked)
  {
    if (columnname != a && columnname != b && columnname != c)
    {
      "statement 1"
    }
  }
else
  {
    if (columnname != a && columnname != b && columnname != c 
        && columnname != A2)
    {
      "statement 1"
    }
  }
Its like I need to run an if statement within the conditions of an if statement if that makes sense, like this psuedo form:
if (columnname != a 
    && columnname != b 
    && columnname != c 
    && if(checkbox.checked{columnname != A2})