title: Multiple linq "from" and variables visibility
body: <p>I am trying to understand why this linq does not compile (<strong>fundInvoices</strong> aren't visible):</p>
  
  <pre><code>Dictionary&lt;Fund, IEnumerable&lt;Invoice&gt;&gt; paidfundInvoices;
  ...
  from fundInvoices in paidfundInvoices
  from p in fundInvoices.Value
  group p by p.VendorId into ps
  select new Payment
  {
      FundId = fundInvoices.Key.FundId, // ERROR here
      Value = ps.Sum(p =&gt; p.Amount)
  }
  </code></pre>
  
  <p>So I went on to change this to anonymous type usage, and <strong>fundInvoices</strong> are magically visible here:</p>
  
  <pre><code>from fundInvoices in paidfundInvoices
  select new
  {
      Fund = fundInvoices.Key,
      Payments = from p in fundInvoices.Value
                 group p by p.VendorId into ps
                 select new Payment
                 {
                     FundId = fundInvoices.Key.FundId,  // NO ERROR                                                                                                                                    
                     Value = ps.Sum(p =&gt; p.Amount)
                 }
  };
  </code></pre>
  
  <p>But that anonymous type seems to be redundant, I do not make any use of that. I just need a flat list of <strong>Payment</strong> objects. However my code only compiles that way...   </p>