AsymmetricAlgorithm.Dispose 方法

定義

釋放 AsymmetricAlgorithm 類別目前的執行個體所使用的全部資源。Releases all resources used by the current instance of the AsymmetricAlgorithm class.

多載

Dispose()

釋放 AsymmetricAlgorithm 類別目前的執行個體所使用的全部資源。Releases all resources used by the current instance of the AsymmetricAlgorithm class.

Dispose(Boolean)

釋放 AsymmetricAlgorithm 類別所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。Releases the unmanaged resources used by the AsymmetricAlgorithm class and optionally releases the managed resources.

Dispose()

釋放 AsymmetricAlgorithm 類別目前的執行個體所使用的全部資源。Releases all resources used by the current instance of the AsymmetricAlgorithm class.

public:
 virtual void Dispose();
public void Dispose ();
abstract member Dispose : unit -> unit
override this.Dispose : unit -> unit
Public Sub Dispose ()

實作

備註

Dispose 使用完畢時,請呼叫 AsymmetricAlgorithmCall Dispose when you are finished using the AsymmetricAlgorithm. Dispose 方法會將 AsymmetricAlgorithm 保留在無法使用的狀態。The Dispose method leaves the AsymmetricAlgorithm in an unusable state. 在呼叫之後 Dispose ,您必須釋放所有對的參考, AsymmetricAlgorithm 讓垃圾收集行程可以回收所佔用的記憶體 AsymmetricAlgorithmAfter calling Dispose, you must release all references to the AsymmetricAlgorithm so the garbage collector can reclaim the memory that the AsymmetricAlgorithm was occupying.

如需詳細資訊,請參閱 清除非受控資源執行處置方法For more information, see Cleaning Up Unmanaged Resources and Implementing a Dispose Method.

注意

在您釋放最後一個 Dispose 參考之前,請務必呼叫 AsymmetricAlgorithmAlways call Dispose before you release your last reference to the AsymmetricAlgorithm. 否則工作窗格所使用的資源不會釋放,直到記憶體回收行程呼叫 AsymmetricAlgorithm 物件的 Finalize 方法。Otherwise, the resources it is using will not be freed until the garbage collector calls the AsymmetricAlgorithm object's Finalize method.

適用於

Dispose(Boolean)

釋放 AsymmetricAlgorithm 類別所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。Releases the unmanaged resources used by the AsymmetricAlgorithm class and optionally releases the managed resources.

protected:
 virtual void Dispose(bool disposing);
protected:
 abstract void Dispose(bool disposing);
protected virtual void Dispose (bool disposing);
protected abstract void Dispose (bool disposing);
abstract member Dispose : bool -> unit
override this.Dispose : bool -> unit
abstract member Dispose : bool -> unit
Protected Overridable Sub Dispose (disposing As Boolean)
Protected MustOverride Sub Dispose (disposing As Boolean)

參數

disposing
Boolean

true 表示釋放 Managed 和 Unmanaged 資源,false 則表示只釋放 Unmanaged 資源。true to release both managed and unmanaged resources; false to release only unmanaged resources.

備註

公用方法和方法會呼叫這個方法 Dispose() FinalizeThis method is called by the public Dispose() method and the Finalize method. Dispose()``Dispose(Boolean)使用設定為的參數叫用受保護的方法 disposing trueDispose() invokes the protected Dispose(Boolean) method with the disposing parameter set to true. FinalizeDispose 設定為的叫用 disposing falseFinalize invokes Dispose with disposing set to false.

disposing 參數為 true 時,這個方法會釋放 AsymmetricAlgorithm 參考的任何 Managed 物件所掌握的資源。When the disposing parameter is true, this method releases all resources held by any managed objects that this AsymmetricAlgorithm references. 這個方法會叫用每個參考物件的 Dispose() 方法。This method invokes the Dispose() method of each referenced object.

給實施者的注意事項

Dispose 可以被其他物件呼叫多次。 Dispose can be called multiple times by other objects. 覆寫時 Dispose(Boolean) ,請小心不要參考先前在先前的呼叫中處置的物件 DisposeWhen overriding Dispose(Boolean), be careful not to reference objects that have been previously disposed in an earlier call to Dispose. 如需如何執行的詳細資訊 Dispose(Boolean) ,請參閱實 [處置方法](/dotnet/standard/garbage-collection/implementing-dispose)。For more information about how to implement Dispose(Boolean), see [Implementing a Dispose Method](/dotnet/standard/garbage-collection/implementing-dispose).

如需和的詳細資訊 Dispose Finalize ,請參閱 清除非受控資源For more information about Dispose and Finalize, see Cleaning Up Unmanaged Resources.

適用於