Net.Pkcs11Interop.LowLevelAPI40.Pkcs11.Dispose C# (CSharp) Method

Dispose() protected method

Disposes object
protected Dispose ( bool disposing ) : void
disposing bool Flag indicating whether managed resources should be disposed
return void
        protected virtual void Dispose(bool disposing)
        {
            if (!this._disposed)
            {
                if (disposing)
                {
                    // Dispose managed objects
                }

                // Dispose unmanaged objects
                Release();

                _disposed = true;
            }
        }

Same methods

Pkcs11::Dispose ( ) : void

Usage Example

        public void _01_BasicPkcs11DisposeTest()
        {
            if (Platform.UnmanagedLongSize != 4 || Platform.StructPackingSize != 0)
                Assert.Inconclusive("Test cannot be executed on this platform");

            // Unmanaged PKCS#11 library is loaded by the constructor of Pkcs11 class
            // and unloaded by Dispose() method.
            Pkcs11 pkcs11 = new Pkcs11(Settings.Pkcs11LibraryPath);
            
            // Do something  interesting
            
            pkcs11.Dispose();
        }