My objective with this code is to use the foreach loop to go through each object and write the current string value to a txt file.
I'm using "Woof" and "Bull" as a test. Bull is the string variable in my AverageValues class.
Unfortunately, it currently will not write the value of bull to the file, however, it will create the file.
I think this is something easy to fix, I'm just can't seem to find it right now.
All help would be appreciated!
public void doStuff()
{
AverageValues AVS = new AverageValues();
AVS.Bull = "Woof";
string path = "C:\\users\\kjenks11\\Averages.txt";
FileStream NewFile = File.Create(path);
StreamWriter writeIt = new StreamWriter(NewFile);
List<AverageValues> AV = new List<AverageValues>();
AV.Add(AVS);
foreach (var value in AV)
{
writeIt.Write(value.Bull);
}
NewFile.Close();
}