title: Use winform checkbox to linq query
body: <p>Hope I am asking this question in the right way.  </p>
  
  <p>I am trying to determine the most efficient way to use checkboxes to alter what is returned from my linq query without having to code for every possible combination.</p>
  
  <p>As an example, I have three checkboxes on my winform that represent three columns that I am trying to query </p>
  
  <p>[ ] Year</p>
  
  <p>[ ] Make</p>
  
  <p>[ ] Model</p>
  
  <p>I am using a linq statement to determine the distinct combinations of year make and model through EF</p>
  
  <pre><code>var uniquecombos = cb.MakeModelYear.Where(i =&gt; i.Year != null &amp;&amp; i.Make != null &amp;&amp; i.Model != null).Distinct().ToList();
  </code></pre>
  
  <p>What I would like to do is use the checkboxes on my winform to drive which fields I include in my query.</p>
  
  <p>So</p>
  
  <p>[x] Year</p>
  
  <p>[x] Make</p>
  
  <p>[ ] Model</p>
  
  <p>would yield</p>
  
  <pre><code>var uniquecombos = cb.MakeModelYear.Where(i =&gt; i.Year != null &amp;&amp; i.Make != null).Distinct().ToList();
  </code></pre>
  
  <p>Is there a good way to modify the inputs of the query without having to account for every combination of checkboxes through if statements?</p>
  
  <p>Thanks in advance!</p>