title: How do I change my query based on user input via checkboxes?
body: <p>Here's my code:</p>
  
  <pre><code>var query = from x in Data
  
  select new { Fruit = x[0], Animal, x[2], Color = x[3], Food = x[4] };
  </code></pre>
  
  <p>Now, I want to create checkboxes such that if a user checks off "box 1" it will do a different query like so:</p>
  
  <pre><code>select new { Fruit = x[7], Animal, x[4], Color = x[8], Food = x[9] };
  </code></pre>
  
  <p>My question is, <strong>how do I make it so that depending on which checkbox is checked a different <code>select...new</code> statement will be used</strong>?  </p>
  
  <p>I think I can use multiple if/then statements to see which particular box is checked and to determine which <code>select...new</code> statement to use, but I'm guessing there is a better way out there.  </p>
  
  <p>In VB I think a "case" statement would come into play, but I don't know what is the C# equivalent.</p>
  
  <p>My failed attempt at implementing case/switch in the context of changing query parameters:</p>
  
  <pre><code>int caseSwitch = 1;
  var query = from x in Data
  
  switch (caseSwitch)
  {
  
         case 1:
             select new { Fruit = x[0], Animal, x[2], Color = x[3], Food = x[4] };
             break;
  
         case 2:
             select new { Fruit = x[7], Animal, x[4], Color = x[8], Food = x[9] };
             break;
  }
  </code></pre>