title: C# Refactor LINQ query of Dictionary into a single lambda expression
body: <p>I am relatively new C# programmer and trying to improve my LINQ query skills. I prefer using method chaining for my queries but I am struggling. Is it possible to refactor this LINQ into a single lambda expression? The code here is a simplified example. My goal is to return the Value of Key=1 in a single line. I want the LINQ query to search and return a string value of Key 1 in single Lambda expression. Thanks!</p>
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  
  namespace DictionaryPractice
  {
      class Program
      {        
          static void Main(string[] args)
          {
              Dictionary&lt;int, string&gt; myd = new Dictionary&lt;int, string&gt;();
              myd.Add(1, &quot;one&quot;);
              myd.Add(2, &quot;two&quot;);
              myd.Add(3, &quot;three&quot;);
              myd.Add(4, &quot;four&quot;);
              
              foreach (var i in myd)
                  Console.WriteLine(i.Value);
              Console.WriteLine(&quot;&quot;);
  
              var b = myd.Where(c =&gt; c.Key == 1).Select(c =&gt; c.Value).ToList();
              Console.WriteLine($&quot;Desired output: {b[0]}&quot;);
          }
      }
  }
  </code></pre>