title: Invoking Lambdas at Creation
body: <p>In javascript, it is common to use closures and create then immediately invoke an anonymous function, as below:</p>
  
  <pre><code>var counter = (function() {
      var n = 0;
      return function() { return n++; }
  }());
  </code></pre>
  
  <p>Due to strong typing, this very verbose in C#:</p>
  
  <pre><code>Func&lt;int&gt; counter = ((Func&lt;Func&lt;int&gt;&gt;)(() =&gt;
  {
      int n = 0;
      return () =&gt; n++;
  }))();
  </code></pre>
  
  <p>Is there a more elegant way to go about this type of thing in C#?</p>