title: Dynamic where condition in LINQ
body: <p>I have a scenario where I have to use a dynamic where condition in LINQ. </p>
  
  <p>I want something like this:</p>
  
  <pre><code>public void test(bool flag)
  {
     from e in employee
     where e.Field&lt;string&gt;("EmployeeName") == "Jhom"
     If (flag == true)
     {
         e.Field&lt;string&gt;("EmployeeDepartment") == "IT"
     }
     select e.Field&lt;string&gt;("EmployeeID")
  }
  </code></pre>
  
  <p>I know we can't use the 'If' in the middle of the Linq query but what is the solution for this?</p>
  
  <p>Please help...</p>