How can I read (save) different lines (of numeric values) of a csv file into different arrays in C#
<p>I am new in C# and trying to build a sort of calculator application that will read values from a csv file and then carry on with the manipulation that's needed.</p>

<p>the calculator algorithm is working fine but I need to populate the arrays from a csv file. I have used StreamReader as follows but it puts all values into a single array:</p>

<pre><code>FileStream aFile = new FileStream("d:\test.txt", FileMode.Open, FileAccess.Read);
                StreamReader sr = new StreamReader(aFile);
                strLine = sr.ReadLine();
               while (strLine != null)
                {
                    strArray = strLine.Split(charArray);
                    for (int x = 1; x &lt;= strArray.GetUpperBound(0); x++)
                    {
                        Console.WriteLine(strArray[x].Trim());
</code></pre>

<p>I need to read seperate lines into separate arrays and these lines can be dynamic (i.e. csv files can have n number of lines which will require n arrays). The calculator algorithm is below and is working fine. I only need how to use the above code to read csv into arrays and use those arrays in the code below (code below, though an excerpt, is working fine). Any help please.</p>

<pre><code>for (int p = 0; p &lt; n; p++)   
       { 
         for (int j = 0; j &lt; t; j++)
            {
                sum[j] = w[p, j] * a[p, j];
                k[p] = k[p] + sum[j];
            }
        }
        double loa=0;
        for (int i = 0; i &lt; n; i++)
        {
            loa1[i] = k[i] * v[i];
            loa += loa1[i];
</code></pre>
