using System;
using System.IO;
publicclass IOExample
{
staticvoid Main() {
FileStream fs;
StreamWriter sw;
try {
fs = new FileStream("practice.txt", FileMode.Open );
sw = new StreamWriter(fs);
// write a line to the file
string newLine = "Not so different from you and me";
sw.WriteLine(newLine);
// close the streams
sw.Close();
fs.Close();
} catch (IOException ioe) {
Console.WriteLine("IOException occurred: "+ioe.Message);
}
}
}