public void Dispose() { try { if (Getter != null) { Getter.Dispose(); Getter = null; } } catch { } }
private bool disposedValue = false; // To detect redundant calls void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { // TODO: dispose managed state (managed objects). Getter.Dispose(); } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. disposedValue = true; } }
/// <summary> /// Removes both the getter and the setter spies, reverting the target method to call-through always. /// </summary> public void Dispose() { Getter?.Dispose(); Setter?.Dispose(); }