Having a mental block today, need a hand verifying my logic isn\'t fubar\'ed.
Traditionally I would do file i/o similar to this:
FileStream fs = null
You're just being paranoid and it will work the way you intend it to :)
A using statement is equivalent to a try/finally block, whether it's inside a try/catch or not.
So your code is similar to:
try
{
FileStream fs = null;
try
{
fs = File.Open("Foo.txt", FileMode.Open);
// Do stuff
}
finally
{
if (fs != null)
{
fs.Dispose();
}
}
}
catch(Exception)
{
/// Handle Stuff
}