title: Is creating tasks via a for loop different to creating them individually?
body: <p>The problem i am having seems to be related to task creation.  After using a loop to populate a task array, and starting them within a separate loop, my results, although consistent, are wrong.  However, if i populate the array individually, the start each task within a loop, everything is fine. Can any one offer me some advice?</p>
  
  <p>For example, this is problematic:</p>
  
  <pre><code>int c = 1;
  for (int i = 1; i &lt;= 4; i++)
      {
         taskArray[i-1] = new Task(() =&gt; calculateRows(c, true));
         c = c + 2;
      }
  foreach (Task t in taskArray) t.Start();
  </code></pre>
  
  <p>but this works fine:</p>
  
  <pre><code>taskArray[0] = new Task(() =&gt; calculateRows(1, true));
  taskArray[1] = new Task(() =&gt; calculateRows(3, true));
  taskArray[2] = new Task(() =&gt; calculateRows(5, true));
  taskArray[3] = new Task(() =&gt; calculateRows(7, true));
  foreach (Task t in taskArray) t.Start();
  </code></pre>