I have a code that stored the data to a temporary array.
string filename = openFileDialog1.FileName;
string[] line = File.ReadAllLines(filename);
using (var reader2 = File.OpenText(@filename))
{
for (int i = 0; i < line.Length; i++)
{
string lines = reader2.ReadLine();
var data = lines.Split(',');
double[,] arrayTemp = new double[line.Length, 2];
arrayTemp[i, 0] = double.Parse(data[0]);
arrayTemp[i, 1] = double.Parse(data[1]);
}
Array.Copy(arrayTemp, GlobalDataClass.dDataArray, line.Length); //error the name "arrayTemp" does not exist in the current context.
}
Since 2d array is not resizable and I want my global array to be flexible,so I use the Array.Copy method to copy the temp array to the Global class array. However I got an error as commented in my code above.
My question is how to copy the tempArray to the global class array.
Any idea how to fix this?