Iam having trouble writing my results to a CSV file.The results i have are as follows
-0.025 0.15 0.15 0.4 0.5 -0.05 0.1333333 0.2 0.4 0.5 -0.05 0.1333333 0.2 0.4 0.5 -0.05 0.1333333 0.2 0.4 0.5 -0.05 0.1333333 0.2 0.4 0.5
When i am writing them to the file it just prints them in one low row.
I want the program to take a new row after 5 results:
-0.025 0.15 0.15 0.4 0.5
-0.05 0.1333 0.2 0.4 0.5
and so on.my code so far is as folows:
foreach (KeyValuePair<int, float> _value in dic1)
{
averageLine1.Add(_value.Value);
string Result = Convert.ToString(_value.Value);
// Create a new file called 'TraceAverages.csv'and write the values to it:
using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\40025634\Desktop\Project\List1Averages.csv", true))
{
file.Write("{0},", Result);
}
}
averageLine1.Clear();
}
ANY IDEAS?