User FAQs

If you have a question, please send it to us.


1) Write code to write data to a text file using a StreamWriter ?

string[] lines = { "Monday", "Tuesday", "Wednesday", "Thursday" }; 

System.IO.StreamWriter oStreamWriter;
oStreamWriter = new System.IO.File.StreamWriter(@"C:\\temp\\myfile.txt");

using (oStreamWriter)
{
   foreach (var line in lines)
   {
      oStreamWriter.WriteLine(line);
   }
}

2) Write code to read data from a text file using a StreamReader ?







© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext