using is basically the equivalent of:
try
{
// code
}
finally
{
obj.Dispose();
}
So it also has the benefit of calling Dispose() even if an unhandled exception is thrown in the code within the block.
using is basically the equivalent of:
try
{
// code
}
finally
{
obj.Dispose();
}
So it also has the benefit of calling Dispose() even if an unhandled exception is thrown in the code within the block.