Looping the arraylist? Using Asp.net?
<p>In web application, I have an arraylist, </p>

<pre><code>   ArrayList lists = new ArrayList();
        lists.Add("S");
        lists.Add("A");
        lists.Add("S");
        lists.Add("I");
        lists.Add("D");
        lists.Add("H");
</code></pre>

<p>now i am trying to remove the arraylist items with no of count.
 that means if i have count =8 then loop will run for 8 times and remove the arraylist item  like :</p>

<pre><code>   1 2  3  4 5 6 7 8 
   S A  S  I D H S **A**

   A is removing from arraylist

  after that  arraylist is  S S I D H only again

   1 2 3 4 5 6 7 8 
   S  S I D H S S **I**

   I is removing from arraylist

   like this upto single item in arraylist .
</code></pre>

<p>i used for condition but no use.
my code is </p>

<pre><code>     ArrayList lists = new ArrayList();
        lists.Add("S");
        lists.Add("A");
        lists.Add("S");
        lists.Add("I");
        lists.Add("D");
        lists.Add("H");

        int lent =8;

        for (int k = 1; k &lt;= lent; k++)
        {
            if (k == lent)
            {
                if (lists.Count == 1)
                {
                    break;
                }
                else
                {


                    lists.RemoveAt(k-1);                        
                    k = 0;
                }
            }
        }
</code></pre>
