Skip to content

Instantly share code, notes, and snippets.

@droyad
Created May 2, 2012 11:18
Show Gist options
  • Save droyad/2575909 to your computer and use it in GitHub Desktop.
Save droyad/2575909 to your computer and use it in GitHub Desktop.
Stream stream = null;
try
{
stream = new FileStream("file.txt", FileMode.OpenOrCreate);
using (StreamWriter writer = new StreamWriter(stream))
{
stream = null;
// Use the writer object...
}
}
finally
{
if(stream != null)
stream.Dispose();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment