title: C# Linq adding to dictionary with list as value
body: <p>I have a dictionary like this:</p>
  
  <pre><code>Dictionary&lt;string, List&lt;myobject&gt;&gt;
  </code></pre>
  
  <p>As I am getting new items, I'm doing logic like this:</p>
  
  <pre><code>mydictionary[key].add(mynewobject);
  </code></pre>
  
  <p>now, I'm trying to do the same with LINQ, but I'm stuck on the last line:
  (please ignore the bit of irrelevant logic in the code):</p>
  
  <pre><code>var Test =
      (from F in Directory.EnumerateFiles(SOURCE_FOLDER, SOURCE_EXTENSIONS, SearchOption.AllDirectories)
      let Key = ParenthesisGroupRegex.Replace(F.ToLower(), string.Empty).Trim()
      let Descriptions =
          (from Match Match in ParenthesisGroupRegex.Matches(F.ToLower())
          let CleanedMatches = ParenthesisRegex.Replace(Match.Name, string.Empty)
          let MatchesList = CleanedMatches.Split(',')
          select new Description { Filename = F, Tag = MatchesList.ToList() })
      group Descriptions by Key into DescriptionList
      select new KeyValuePair&lt;string, IEnumerable&lt;string&gt;&gt;(Key, DescriptionList))
  </code></pre>
  
  <p>If we look at the last two lines:
  I'm trying to get my List (List
  
  <p>and on the last linne, I'm attempting to build dictionary entries, but this will not compile as it looks like neither Key, nor DescriptionList, are accessible at that stage.</p>
  
  <p>(btw, I'm currently learning the LINQ syntax, so readability and maintainability are not the focus right now)</p>
  
  <p>What did I miss?</p>