CSharp - Text File Write

Description

Text File Write

Demo

using System;
using System.IO;//from ww w .  j ava  2s. com

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