IndexOutOfRangeException for some strange reasons
<p>I came across this strange IndexOutOfRangeException exception. The code I am working with was originally a C code, I have managed to translate it to C#</p>

<p>So I the followin loop gives me the error:</p>

<pre><code>for (int i = 0; i &lt; 6; i++)
{
    L[0] = new double[]{ T[0] + rxp[0][i] - (p[0][i])
}
</code></pre>

<p>According to the 'Locals' tab, rxp has only 3 'children' with only 1 items / child. 
So I guess the problem is here:</p>

<pre><code>void getrxp()
{
    for (int i = 0; i &lt; 6; i++)
    {
        rxp[0] = new double[]{ M[0][0] * (re[0][i]) + M[0][1] * (re[1][i]) + M[0][2] * 0};
        rxp[1] = new double[]{ M[1][0] * (re[0][i]) + M[1][1] * (re[1][i]) + M[1][2] * 0};
        rxp[2] = new double[]{ M[2][0] * (re[0][i]) + M[2][1] * (re[1][i]) + M[2][2] * 0};
    }
}
</code></pre>

<p>Am I getting this to to create a <code>double rxp[3][6];</code> array wrong or there is something else? </p>

<p>The original code looks like this (C):</p>

<pre><code>void getrxp()
{
  for(int i=0;i&lt;6;i++){
    rxp[0][i] = M[0][0]*(re[0][i])+M[0][1]*(re[1][i])+M[0][2]*0;
    rxp[1][i] = M[1][0]*(re[0][i])+M[1][1]*(re[1][i])+M[1][2]*0;
    rxp[2][i] = M[2][0]*(re[0][i])+M[2][1]*(re[1][i])+M[2][2]*0;  
  }
}
</code></pre>