title: Using Lambda with Dictionaries
body: <p>I am trying to use LINQ to retrieve some data from a dictionary.</p>
  
  <pre><code>    var testDict = new Dictionary&lt;int, string&gt;();
      testDict.Add(1, "Apple");
      testDict.Add(2, "Cherry");
  
      var q1 = from obj in testDict.Values.Where(p =&gt; p == "Apple");
      var q2 = from obj in testDict.Where(p =&gt; p.Value == "Apple");
  </code></pre>
  
  <p>The above lines, q1 and q2, both result in a compiler error.</p>
  
  <pre><code>error CS0742: A query body must end with a select clause or a group clause
  </code></pre>
  
  <p>How do I go about using LINQ to find values in a dictionary?</p>
  
  <p>Thank you,</p>
  
  <p>Rick</p>