How to create an array in a for loop
<p>Ok, I need to create two arrays like this:</p>

<pre><code>        double[][] TrainPatterns = { 
            new double[] { 0.0, 0.0 },
            new double[] { 0.0, 1.0 },
            new double[] { 0.0, 2.0 }
        };
        double[][] TrainResults = {
            new double[] { 0.0 },
            new double[] { 1.0 },
            new double[] { 1.0 }
        };
</code></pre>

<p>But with 100 items each.</p>

<p>I am reading the values for arrays from an image (TrainPatterns contains x and y coordinates of a pixel, TrainResults contains the color of the pixel, 0 for black, 1 for white).</p>

<p>I am iterating through the image like this:</p>

<pre><code>        Bitmap objBitmap = new Bitmap("im.bmp");
        for (int y = 0; y &lt; objBitmap.Height; y++)
        {
            for (int x = 0; x &lt; objBitmap.Width; x++)
            {
                // here I need to insert new double[] { (double)x, (double)y } to the
                // TrainPatterns array
                Color col = objBitmap.GetPixel(x, y);
                if (col.R == 255 &amp;&amp; col.G == 255 &amp;&amp; col.B == 255)
                {
                    // white color
                    // here I need to insert new double[] { 1.0 } to the
                    // TrainResults 
                }
                if (col.R == 0 &amp;&amp; col.G == 0 &amp;&amp; col.B == 0)
                {
                    // black color
                    // here I need to insert new double[] { 0.0 } to the
                    // TrainResults 
                }
            }
        }
</code></pre>

<p>How can I add items to those arrays dynamically in the for loop? I know that image has 10px width and 10px height so I know the arrays will both have 100 length.</p>
