title: Dynamically build a condition on a DataTable using a Dictionary
body: <p>Currently I can query my <code>DataTable</code> (<em>dtContacts</em>) like this:
  If I am looking for a person whose <code>FirstName</code> is "John" and <code>LastName</code> is "Smith". My result will be</p>
  
  <pre><code>DataTable dt = dtContacts.AsEnumerable().Where(c =&gt; c.Field&lt;string&gt;("FirstName") == "John" &amp;&amp; c.Field&lt;string&gt;("LastName") == "Smith").CopyToDataTable();
  </code></pre>
  
  <p>But such static querying does not help me because my conditions may be slightly more complicated than this. So I would like my LINQ to be a bit more dynamic so it can accommodate the following scenario.</p>
  
  <p>I am going to save my condition in a <code>Dictionary&lt;string,string&gt;</code> like this:</p>
  
  <pre><code>Dictionary&lt;string, string&gt; dicConditions = new Dictionary&lt;string, string&gt;();
  dicConditions.Add("FirstName", "John");
  dicConditions.Add("LastName", "Smith");
  dicConditions.Add("IsCustomer", "Yes");
  </code></pre>
  
  <p>Note that we can add as many conditions as we want to this dictionary.
  And let's assume that the main <code>DataTable</code> <em>dtContacts</em> always contains the column names that are mentioned in the dictionary keys so we do not need to check for that every time.</p>
  
  <p>In the new version we would like our LINQ to act according to <code>dicConditions</code> and return all the values whose <code>FirstName</code> is "John", <code>LastName</code> is "Smith" and <code>IsCustomer</code> is "Yes".</p>
  
  <p>How should this new dynamic LINQ query look like?</p>