Save text to a text file - CSharp File IO

CSharp examples for File IO:Text File

Description

Save text to a text file

Demo Code

using System;//from w w w .j a  v a2 s . c  om
using System.IO;
class Program
{
   static void Main(string[] args)
   {
      StreamWriter writer = new StreamWriter("test-file.txt", true);
      writer.WriteLine("Visual Studio is the best IDE");
      writer.Close();
      Console.WriteLine("Wrote to file");
   }
}

Result


Related Tutorials