I just want to know is it safe/ good approach to call return
inside a using
block.
For ex.
using(var scope = new TransactionScope())
{
// my core logic
return true; // if condition met else
return false;
scope.Complete();
}
We know the at the last most curly brace dispose()
will get called off. But what will be in the above case, since return
jumps the control out of the given scope (AFAIK)...
- Is my
scope.Complete()
get called? - And so for the scope's
dispose()
method.