I've been trying to create a tab limited text file in c# so that the data are properly shown in separate columns.
Firstname Lastname Age
John Smith 17
James Sawyer 31
I have tried the "\t" character but all I get is this:
Firstname Lastname Age
John Smith 17
James Sawyer 31
Here is my code:
string[,] P = new string[2, 3] {
{ "John", "Smith", "17" },
{ "James", "Sawyer", "31" }
};
using (StreamWriter s_w = new StreamWriter(target))
{
s_w.WriteLine("Firstname \t Lastname \t Age");
for (int i = 0; i < 2; i++)
{
s_w.WriteLine("{0} \t {1} \t {2}", P[i,0], P[i,1], P[i,2]);
}
}