Пример #1
0
 // This code added to correctly implement the disposable pattern.
 public void Dispose()
 {
     if (!isDisposed)
     {
         Janitor.Dispose();
         isDisposed = true;
     }
 }
Пример #2
0
        private bool _isDisposed = false; // To detect redundant calls

        public void Dispose()
        {
            if (!_isDisposed)
            {
                Terminate();
                Janitor.Dispose();
                _isDisposed = true;
            }
        }