public T Add <T>(T disposable) where T : class, IDisposable { this.CheckDisposed(); if (disposable == null) { return(disposable); } bool flag = false; try { this.AddGuardedObject(disposable); flag = true; } finally { if (!flag) { DisposeGuard.DisposeIfPresent(disposable); } } return(disposable); }
private void RemoveLastGuardedObject() { DisposeGuard.DisposeIfPresent(this.SwapSlot((int)(this.SlotCount - 1), null)); this.SlotCount -= 1; }