Image.Dispose 方法

定義

釋放這個 Image 所使用的所有資源。Releases all resources used by this Image.

多載

Dispose()

釋放這個 Image 所使用的所有資源。Releases all resources used by this Image.

Dispose(Boolean)

釋放 Image 所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。Releases the unmanaged resources used by the Image and optionally releases the managed resources.

備註

注意

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

Dispose()

釋放這個 Image 所使用的所有資源。Releases all resources used by this Image.

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

實作

備註

呼叫 Dispose 方法,可讓此 Image 所使用的資源重新配置供其他用途之用。Calling the Dispose method allows the resources used by this Image to be reallocated for other purposes.

Dispose 使用完畢時,請呼叫 ImageCall Dispose when you are finished using the Image. Dispose 方法會將 Image 保留在無法使用的狀態。The Dispose method leaves the Image in an unusable state. 呼叫 Dispose之後,您必須釋放所有對 Image 的參考,讓垃圾收集行程可以回收 Image 所佔用的記憶體。After calling Dispose, you must release all references to the Image so the garbage collector can reclaim the memory that the Image was occupying. 如需詳細資訊,請參閱清除非受控資源執行 Dispose 方法For more information, see Cleaning Up Unmanaged Resources and Implementing a Dispose Method.

注意

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

Dispose(Boolean)

釋放 Image 所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。Releases the unmanaged resources used by the Image and optionally releases the managed resources.

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 資源。true to release both managed and unmanaged resources; false to release only unmanaged resources.

備註

注意

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

適用於