/// <summary> /// Dispose a disposable object and set the reference to null. Removes this object from the ToDispose list. /// </summary> /// <param name="objectToDispose">Object to dispose.</param> protected internal void RemoveAndDispose <T>(ref T objectToDispose) { if (!ReferenceEquals(objectToDispose, null) && DisposeCollector != null) { DisposeCollector.RemoveAndDispose(ref objectToDispose); } }
// Disposes of an IDisposable object immediately and also removes the object from the // collection of disposable objects. protected internal void RemoveAndDispose <T>(ref T objectToDispose) { // If objectToDispose is not null, and if the DisposeCollector is available, have // the DisposeCollector get rid of objectToDispose. if (!ReferenceEquals(objectToDispose, null) && (DisposeCollector != null)) { DisposeCollector.RemoveAndDispose(ref objectToDispose); } }