語言

SecureEnvironment.Dispose 方法

定義

釋放 所使用的 SecureEnvironment資源。

多載

名稱 Description
Dispose()

釋放 SecureEnvironment所使用的所有資源。

Dispose(Boolean)

釋放 未管理的資源, SecureEnvironment 並可選擇性地釋放受管理資源。

Dispose()

釋放 SecureEnvironment所使用的所有資源。

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

實作

備註

應用程式Dispose()完成後應會呼叫SecureEnvironment。 在被呼叫後 Dispose() ,分配給 的 SecureEnvironment 資源會被垃圾回收器回收。 欲了解更多資訊,請參閱《 清理未管理資源 及 實施處置方法》。

Note

請務必在最後一次提及Dispose()該資訊發布前致電SecureEnvironment。 若 Dispose() 未呼叫,分配給 的 SecureEnvironment 資源將不會被釋放,直到垃圾回收器呼叫該實例的方法 Finalize 。

適用於

Dispose(Boolean)

釋放 未管理的資源, SecureEnvironment 並可選擇性地釋放受管理資源。

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

參數

disposing
Boolean

true 釋放可管理與非受管理資源; false 只釋放未管理的資源。

備註

此方法由公開方法呼叫,若Dispose()方法已被覆寫則由 該Finalize()方法呼叫。 Dispose() 呼叫受保護 Dispose(Boolean) 的方法,參數 disposing 設為 true。 Finalize 指定 disposing 參數為 false。

當參數 disposing 為 true時,此方法會釋放所有被該 SecureEnvironment 參考物件所持有的資源。 此方法會 Dispose() 呼叫每個被參考物件的方法。

給繼承者的注意事項

Dispose 可以被其他物件多次呼叫。 覆寫 Dispose(Boolean)時,請小心不要引用先前在呼叫中 Dispose已處理的物件。 欲了解更多如何實施 Dispose(Boolean),請參閱「 實施處置方法」。

關於 和 Dispose的更多資訊Finalize(),請參見「清理未管理資源及覆寫最終化方法」。

適用於