private void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { _handle?.Close(); } _disposed = true; }
private bool disposedValue; // To detect redundant calls private void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { Log.Information("Notifying threads to quit"); _invertedCallTokenSource.Cancel(); } Log.Information("Closing handle to control device..."); _deviceHandle?.Close(); Log.Information("Handle closed"); disposedValue = true; } }
public void Close() { SafeObjectHandle.Close(); }