title: Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type
body: <p>I am working with .NET4.5 and VS2013, I have this query that gets <code>dynamic</code> result from db. </p>
  
  <pre><code>dynamic topAgents = this._dataContext.Sql(
      "select t.create_user_id as \"User\", sum(t.netamount) as \"Amount\" from transactiondetail t where t.update_date &gt; sysdate -7 group by t.create_user_id")
      .QueryMany&lt;dynamic&gt;();
  </code></pre>
  
  <p>Following statement fails with compilation error <code>Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree type</code>
  without even allowing me to run it</p>
  
  <pre><code>topAgents.ToList().Select(agent =&gt; new
  {
      User = agent.User != null ? string.Format("{0}", agent.User).Replace("CORPNTGB\\", "") : null,
      Amount = agent.Amount
  });
  </code></pre>
  
  <p>while this one with <code>foreach</code> works just fine.</p>
  
  <pre><code>var data = new List&lt;List&lt;object&gt;&gt;();
  foreach (dynamic agent in topAgents)
  {
      data.Add(new List&lt;object&gt;
      {
          agent.User != null ? string.Format("{0}", agent.User).Replace("CORPNTGB\\", "") : null,
          agent.Amount
      });
  }
  </code></pre>
  
  <p>In my eyes after I <code>topAgents.ToList()</code> they could be interpreted as equivalent, is it because I explicitly state that <code>var data = new List&lt;List&lt;object&gt;&gt;();</code> that second statement is allowed by compiler?</p>
  
  <p><strong>Why doesn't compiler allow LINQ select, but allows for each`?</strong></p>