indexing a collection
<p>I have an with several properties:</p>

<pre><code>MyModel{
public int var1 {get;set;}
public int var2 {get;set;}
public int TheIndex {get;set;}
}
</code></pre>

<p>I use this model to populate a list:</p>

<pre><code>var Output = .... select new MyModel {... TheIndex = 0, ...};
</code></pre>

<p>Then, I want to fill the index of each element with:</p>

<pre><code>int index = 0;
foreach (var a in Output) { a.TheIndex = index++; }
</code></pre>

<p>However, I'm baffled to figure out why it's not adding the index like I think it should. Instead, it's stuck at 0 across the entire collection.</p>

<p>Any ideas?</p>

<p>Thanks.</p>
