ExportLifetimeContext<T>.Dispose ExportLifetimeContext<T>.Dispose ExportLifetimeContext<T>.Dispose ExportLifetimeContext<T>.Dispose Method

定義

ExportLifetimeContext<T> 類別目前的執行個體所使用的資源全部釋出,包括其相關聯的匯出。Releases all resources used by the current instance of the ExportLifetimeContext<T> class, including its associated export.

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

實作

備註

呼叫Dispose方法的ExportLifetimeContext<T>物件呼叫參考的方法,以釋放其相關聯的匯出。Calling the Dispose method of a ExportLifetimeContext<T> object calls the referenced method to release its associated export.

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

如需詳細資訊,請參閱 < 清除 Unmanaged 資源向上實作 Dispose 方法For more information, see Cleaning Up Unmanaged Resources and Implementing a Dispose Method.

注意

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

適用於