Strange behaviour with incrementing int when using Action<> delegate
<p>Given the code below:</p>

<pre><code>class Sample
{
 public static void Run()
 {
     int i = 1;
     Action&lt;int&gt; change = Increment();
     for (int x = 0; x &lt; 5; x++ )
     {
         change(i);
         Console.WriteLine("value=" + i.ToString());
     }
 }

 public static Action&lt;int&gt; Increment()
 {
      return delegate(int i) { i++; };
 }
</code></pre>

<p>} </p>

<p>I get the answer:</p>

<p>value=1
 value=1
 value=1
 value=1
 value=1
 value=1</p>

<p>Instead of 1, 2, 3 ... 6.</p>

<p>This is from an article on the net with links to clues but I can't work out why this is. Anyone have any ideas?</p>
