public void TestIdiotUsesSafeLockDispose() { object instance = new object(); using (SafeLock safeLock = new SafeLock(instance, 0)) { ((IDisposable)safeLock).Dispose();//since the using statement has the same boxed pointer to r, we are allowed to dispose } }
public void TestYouCanDisposeSafeLock() { object instance = new object(); using (IDisposable safeLock = new SafeLock(instance, 0)) { safeLock.Dispose();//since the using statement has the same boxed pointer to r, we are allowed to dispose } }