CSharp - Text File Write

Description

Text File Write

Demo

using System;
using System.IO;//from  ww w. j a  v  a  2 s. c om

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