// This code added to correctly implement the disposable pattern. public void Dispose() { if (!isDisposed) { Janitor.Dispose(); isDisposed = true; } }
private bool _isDisposed = false; // To detect redundant calls public void Dispose() { if (!_isDisposed) { Terminate(); Janitor.Dispose(); _isDisposed = true; } }