DesignerActionService.Dispose 方法

定義

釋放 DesignerActionService 使用的資源。

多載

Dispose()

釋放 DesignerActionService 類別所使用的所有資源。

Dispose(Boolean)

釋放 DesignerActionService 所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。

Dispose()

釋放 DesignerActionService 類別所使用的所有資源。

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

實作

備註

方法是 Dispose 介面所強制的唯一方法實 IDisposable 作。 當您完成使用 DesignerActionService 後,請呼叫這個方法。 它會執行兩個主要動作:

  • 透過呼叫 RemoveService 方法,從設計環境中的可用服務清單中移除目前的服務。

  • 取消訂閱相關聯 IComponentChangeService 介面中的元件變更事件。

Dispose 使用完畢時,請呼叫 DesignerActionServiceDispose 方法會將 DesignerActionService 保留在無法使用的狀態。 呼叫 Dispose之後,您必須釋放 的所有參考, DesignerActionService 讓垃圾收集行程可以回收佔用的 DesignerActionService 記憶體。 如需詳細資訊,請參閱 清除 Unmanaged 資源實作 Dispose 方法

注意

在您釋放最後一個 Dispose 參考之前,請務必呼叫 DesignerActionService。 否則工作窗格所使用的資源不會釋放,直到記憶體回收行程呼叫 DesignerActionService 物件的 Finalize 方法。

另請參閱

適用於

Dispose(Boolean)

釋放 DesignerActionService 所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。

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 表示釋放 Managed 和 Unmanaged 資源,false 則表示只釋放 Unmanaged 資源。

備註

方法是 Dispose 介面所強制的唯一方法實 IDisposable 作。 當您完成使用 DesignerActionService 後,請呼叫這個方法。 它會執行兩個主要動作:

  • 透過呼叫 RemoveService 方法,從設計環境中的可用服務清單中移除目前的服務。

  • 取消訂閱相關聯 IComponentChangeService 介面中的元件變更事件。

如果已覆寫此方法,則由公用 Dispose() 方法和 Finalize() 方法呼叫。 Dispose() 叫用這個方法, disposing 並將 參數設定為 trueFinalize 會叫用這個方法,並將 disposing 設定為 false

disposing 參數為 true 時,這個方法會釋放 DesignerActionService 參考的任何 Managed 物件所掌握的資源。 這個方法會叫用每個參考物件的 Dispose() 方法。

給繼承者的注意事項

Dispose 可以被其他物件呼叫多次。 覆寫 Dispose(Boolean) 時請小心不要參考先前在呼叫 Dispose中處置的物件。 如需如何實 Dispose(Boolean)作 的詳細資訊,請參閱 實作 Dispose 方法

如需 和 Finalize()的詳細資訊Dispose,請參閱清除 Unmanaged 資源覆寫 Finalize 方法

另請參閱

適用於