EventHandlerList.Dispose 方法

定義

處置委派清單。Disposes the delegate list.

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

實作

備註

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

注意

在您釋放最後一個 Dispose 參考之前,請務必呼叫 EventHandlerListAlways call Dispose before you release your last reference to the EventHandlerList. 否則,在垃圾收集呼叫 EventHandlerList 物件的析構函式之前,不會釋放 EventHandlerList 所使用的資源。Otherwise, the resources the EventHandlerList is using will not be freed until garbage collection calls the EventHandlerList object's destructor.

適用於