//// NOTE: Leave out the finalizer altogether if this class doesn't //// own unmanaged resources itself, but leave the other methods //// exactly as they are. //~Encryption() //{ // // Finalizer calls Dispose(false) // Dispose(false); //} // The bulk of the clean-up code is implemented in Dispose(bool) protected virtual void Dispose(bool disposing) { if (disposing) { // Free managed resources. lock (MacProviderLock) { if (_MacProvider != null) { _MacProvider.Dispose(); _MacProvider = null; } } lock (RsaProviderLock) { if (_RsaProvider != null) { _RsaProvider.Dispose(); _RsaProvider = null; } } if (_RsaSignatureHashAlgorithm != null) { _RsaSignatureHashAlgorithm.Dispose(); _RsaSignatureHashAlgorithm = null; } } }