Something like:
using (IDisposable disposable = GetSomeDisposable())
{
//.....
//......
return Stg();
}
I believe it is not a p
That is totally acceptable. A using statement ensures the IDisposable object will be disposed no matter what.
From MSDN:
The using statement ensures that Dispose is called even if an exception occurs while you are calling methods on the object. You can achieve the same result by putting the object inside a try block and then calling Dispose in a finally block; in fact, this is how the using statement is translated by the compiler.