System.IndexOutOfRangeException when forming list
<p>I am trying to form a list with the help of multi-dimensional array that should look like this.</p>

<pre><code>[validatorKey][counter]
1453          10
1231          12
6431          7
1246          1
1458          2
</code></pre>

<p>however, I couldn't cope with it. this is my method by the way. and also the array size should be incremented at the very end of the method. I know I should use Array.Resize(ref array, 2); but since my array is multi dimensional, in this case what should be the appropriate method. </p>

<pre><code>private int AracaAitSeferSayisiDondur(int pValidatorKey)
{
     int iSeferSayisi = 0;
     int[,] iSeferListesi = (int[,])ViewState["SeferListesi"];
     if (iSeferListesi == null)
     iSeferListesi = new int[1,1];

     bool aynisiVarmi = false;

     for (int i = 0; i &lt; iSeferListesi.Length; i++)
     {
        if (iSeferListesi[i,0] == pValidatorKey)
        {
           aynisiVarmi = true;
           iSeferListesi[i,1]++;
           iSeferSayisi = iSeferListesi[i,1]++;
           break;
        }
     }
     if (!aynisiVarmi)
     {
        int arrayLength = iSeferListesi.Length;
        iSeferListesi[arrayLength--, 0] = pValidatorKey;
        iSeferListesi[arrayLength--, 1] = 1;
        //IN THIS PART ARRAY SIZE SHOULD BE INCREASED
        iSeferSayisi = iSeferListesi[arrayLength--, 1];
     }
     ViewState["SeferListesi"] = iSeferListesi;
     return iSeferSayisi;
}
</code></pre>
