title: Entityframework query, only select if variable is not null else don't select
body: <p>I have this kind of query:</p>
  
  <pre><code> var p = form p in db.table 
       where(p.Id ==  variable1  &amp;&amp; p.proId == variable2 ...)
       select p.Tolist();
  </code></pre>
  
  <p>and for eg. if variable 1 is null don't compare that condition in where clause just take the where clause </p>
  
  <pre><code>where (p.proId == variable2 ...)
  </code></pre>
  
  <p>Is there any way to do this . Thanks in advance.</p>