So I have a two-dimensional array and I want to write all data to a text-file. But I want them to appear in columns in the text-file.
(I haven't declared them like this in my code, but I think this is what the array would look like written out):
myArray = [{Jamie, 5}, {Susan, 7}, {Robert, 2}, {Sam, 9}];
I want in the text-file it to look like this:
Jamie 5
Susan 7
Robert 2
Sam 9
I have looked at other answers such as How to write contents of an array to a text file? C# and Format a string into columns but I feel like they are only answering half of my question, and I don't understand them either.
What I have so far is:
using (StreamWriter sw = new StreamWriter(@"../../test.txt", false))
{
foreach ()
{
}
}
I'm not sure what I am supposed to have in foreach().
How do I do this?