MessageQueue.Dispose(Boolean) 方法

定義

處置 (Dispose) MessageQueue 所使用的資源 (除了記憶體之外)。Disposes of the resources (other than memory) used by the MessageQueue.

protected:
 override void Dispose(bool disposing);
protected override void Dispose (bool disposing);
override this.Dispose : bool -> unit
Protected Overrides 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(Boolean) 使用完畢時,請呼叫 MessageQueueCall Dispose(Boolean) when you are finished using the MessageQueue. Dispose(Boolean) 方法會將 MessageQueue 保留在無法使用的狀態。The Dispose(Boolean) method leaves the MessageQueue in an unusable state. 在呼叫之後 Dispose(Boolean) ,您必須釋放所有對的參考, MessageQueue 使其佔用的記憶體可由垃圾收集進行回收。After calling Dispose(Boolean), you must release all references to the MessageQueue so the memory it was occupying can be reclaimed by garbage collection.

Dispose(Boolean) 您釋放最後一個參考之前,您應該先呼叫 MessageQueueYou should call Dispose(Boolean) before you release your last reference to the MessageQueue. 否則,在 MessageQueue 垃圾收集呼叫 MessageQueue 物件的「析構函式」之前,將不會釋放使用的資源。Otherwise, the resources the MessageQueue is using will not be freed until garbage collection calls the MessageQueue object's destructor.

適用於

另請參閱