title: Why can't an anonymous class have a lambda property, but it can have a Func<> property?
body: <p>I'm trying to learn C#'s restrictions on an anonymous type. Consider the following code:</p>
  
  <pre><code>  var myAwesomeObject = new {
        fn1 = new Func&lt;int&gt;(() =&gt; { return 5; }),
        fn2 = () =&gt; { return 5; } 
    };
  </code></pre>
  
  <p>So we've got two properties that are actually functions:</p>
  
  <ul>
  <li><code>fn1</code>: A <code>Func&lt;int&gt;</code> that returns <code>5</code>.</li>
  <li><code>fn2</code>: A lambda function that returns <code>5</code>.</li>
  </ul>
  
  <p>The C# compiler is happy to work with fn1, but complains about fn2 :</p>
  
  <blockquote>
    <p>cannot assign lambda expression to anonymous type property.</p>
  </blockquote>
  
  <p>Can someone explain why one is ok but the other is not?</p>