CSharp - Text File Write

Description

Text File Write

Demo

using System;
using System.IO;//from w  w w  . j a  va2 s .  c  o m

class Program
{
    static void Main(string[] args)
    {
        using (FileStream s = new FileStream(@"c:\MyFile.txt", FileMode.OpenOrCreate))
        {
            // our code
            BinaryWriter bw = new BinaryWriter(s);
            bw.Write("Hello World!");
        }
    }
}

Result