Example #1
0
        /// <summary>
        /// Dispose pattern implementation
        /// </summary>
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposedValue)
            {
                if (disposing)
                {
                    ConsumedCap?.Release();
                }
                else
                {
                    // When called from the Finalizer, we must not throw.
                    // But when reference counting goes wrong, ConsumedCapability.Release() will throw an InvalidOperationException.
                    // The only option here is to suppress that exception.
                    try
                    {
                        ConsumedCap?.Release();
                    }
                    catch
                    {
                    }
                }

                _disposedValue = true;
            }
        }
 /// <summary>
 /// Dispose pattern implementation
 /// </summary>
 protected virtual void Dispose(bool disposing)
 {
     if (!_disposedValue)
     {
         ConsumedCap?.Release();
         _disposedValue = true;
     }
 }