Looping through a list in C#
<p>Say I have a list which has 5 values.</p>

<pre><code>List&lt;Item&gt; Test
Test[0] 
{Item.category,Item.Number,Item.Format,Item.Order} etc
</code></pre>

<p>My requirement is that I have to write some HTML code based on the values inside this list.</p>

<p>The way it should be written is that the same Item.Category values should be written together meaning if there are 5 values for <code>item.category</code> and 3 of them are same and 2 other are different then the 3 items should be combined meaning the <code>item.category</code> will be say the header and the other values like number ,format etc will be the content inside the header.</p>

<p>It should display something like:</p>

<pre><code>&lt;h1&gt;Item.category(the 3 same categories should appear here just one)&lt;/h1&gt;
{
  all other elements * 3 times

  }
</code></pre>

<p>If I have made it  difficult to read and understand please let me know.</p>
