title: I thought C# has lexical scoping, but why this example shows dynamic scoping behavior?
body: <pre><code>    var x = 1;
      Func&lt;int,int&gt; f = y =&gt; x + y;
      x = 2;
      Console.WriteLine(f(1));
  </code></pre>
  
  <p>The output is 3. I would assume it is 2, according to <a href="https://web.archive.org/web/20170426121932/http://www.cs.cornell.edu/~clarkson/courses/csci4223/2013sp/lec/lec12.pdf" rel="nofollow noreferrer">https://web.archive.org/web/20170426121932/http://www.cs.cornell.edu/~clarkson/courses/csci4223/2013sp/lec/lec12.pdf</a></p>