简体   繁体   中英

Export jagged array from C# into text file or excel spreadsheet

All I need to do is take a jagged array and print the values so I can bring it to excel to make graphs. The array is double integer. I have seen alot of posts on doing the opposite but not on bringing it from C# to a text file.

Given: Object[][] myJagged; string outfileName;

StreamWriter sw = new StreamWriter(outfileName);
for(int y = 0; y < myJagged.GetLength(); y++)
{
    for(int x = 0; x < myJagged[y].GetLength(); x++)
        sw.Write(myJagged[y][x].ToString() + ",");
    sw.WriteLine();
}
sw.Close();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM