protected override void UseSample() { TypeIDisposable instance = new TypeIDisposable(); Logger.Info("Disposing the object"); instance.Dispose(); Logger.Info("Object disposed"); }
protected override void UseSample() { try { using (TypeIDisposable instance = new TypeIDisposable()) { throw new Exception(); } } catch (Exception ex) { Logger.Info("Even though an exception was thrown, the Dispose method was called"); } }