I want to use the using statement to control the scope. Can I omit the explicit reference to the underlying object that implements IDisposable ?
For example, using these ads:
class ITransactionScope : IDisposable {} class TransactionGuard : ITransactionScope {...} class DbContext { public IDisposable ITransactionScope() { return new TransactionGuard(); } }
Can I do the following:
void main() { var dbContext = new DbContext(); using (dbContext.TransactionScope()) {
Is TransactionGuard instance active during using statement?
source share