Read/Write text file in C#

//read file
using (TextReader tr = new StreamReader("sample.txt"))
{
  string line = tr.ReadLine();
}
//write file
using (TextWriter tw = new StreamWriter("sample.txt"))
{
  tw.WriteLine("text");
}

Comments

Popular posts from this blog

Tibco Rendezvous (tibrv) C# .Net example

Parse XML to dynamic object in C#