what is the most efficient way to export array elements into a .csv excel file? Now I am doing like this, but it is very slow. Thank you for all your support.
int FrameWidth = 640;
int FrameHeight = 480;
Int16[] Values; // 640 x 480, 307200 elements
/*
.. processing ......
*/
//Exporting Values to .csv file
string string2csv = null;
for (int y = 0; y < FrameHeight; y++)
{
for (int x = 0; x < FrameWidth; x++)
{
string2csv = string2csv + Values[y * FrameWidth + x] + ";";
}
string2csv = string2csv + "\n";
}
File.WriteAllText("string2csv.csv", string2csv);
StringBuilderinstead of+.String.Joinuses aStringBuilderinternally.