title: Determine if Dictionary Contains All of a Set of Keys
body: <p>I'm trying to figure out the best way to determine if a <code>Dictionary&lt;string, string&gt;</code> object contains <em>all</em> of a set of <code>string</code> objects as keys.</p>
  
  <p>I'm probably not making any sense so here's some example code using a definite set of strings:</p>
  
  <pre><code>public static bool ContainsKeys(this Dictionary&lt;string, string&gt; dictionary)
  {
    return dictionary.ContainsKey("fname") &amp;&amp; dictionary.ContainsKey("lname") &amp;&amp; dictionary.ContainsKey("address1") &amp;&amp;
           dictionary.ContainsKey("city") &amp;&amp; dictionary.ContainsKey("state") &amp;&amp; dictionary.ContainsKey("zip");
  }
  </code></pre>
  
  <p>The idea here is to accept an arbitrary set of strings as <code>keys</code> and check if the keys of the <code>Dictionary&lt;string, string&gt;</code> object contain all of the strings in <code>keys</code>.</p>
  
  <p>I was trying to go down the LINQ road with this:</p>
  
  <pre><code>public static bool ContainsKeys(this Dictionary&lt;string, string&gt; dictionary, string[] keys)
  {
    var query = from entry in dictionary
                where keys.Contains(entry.Key)
                select entry;
  
    return query.Any();
  }
  </code></pre>
  
  <p>I have no idea if I'm on the right path though - I think this might work if I wanted to know if <code>dictionary</code> contained any of those strings as keys.</p>