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.
            Asked
            
        
        
            Active
            
        
            Viewed 104 times
        
    -3
            
            
        - 
                    1Jagged? Do you mean a multidimensional array? Show us what have you tried so far? – Leandro Requena Feb 14 '21 at 20:16
- 
                    Yes. Jagged is the same as multi-dimensional I believe. I have tried to the array into lines of strings but I had no luck with that. – jt4 Feb 14 '21 at 20:23
- 
                    No a jagged array is not the same as multi-dimensional. See https://stackoverflow.com/q/597720/1070452 – Ňɏssa Pøngjǣrdenlarp Feb 14 '21 at 20:31
1 Answers
0
            
            
        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();
 
    
    
        Sam Greenberg
        
- 129
- 9
