I am having some trouble writing a string MentionsInText
to a file using the Systems.IO.StreamWriter
according to the file it is edited when the code is run however, no text is present in the file. I am not sure why this is not working.
My code is as follows;
var MIS = string.Join(" ", MentionsList.ToArray());
string Mentionsintext = MIS.ToString();
StreamWriter MentionFile = new StreamWriter(@"C:\Users\User\Documents\Mentions.txt");
MentionFile.WriteLine(Mentionsintext + Environment.NewLine);
Am I doing something wrong when using StreamWriter
?