PrintPropertyDictionary.Dispose 方法

定義

釋放 PrintPropertyDictionary 正在使用的資源。Releases the resources that are being used by the PrintPropertyDictionary.

多載

Dispose()

釋放 PrintPropertyDictionary 正在使用的所有資源。Releases all the resources that are being used by the PrintPropertyDictionary.

Dispose(Boolean)

釋放 PrintPropertyDictionary 正在使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。Releases the unmanaged resources that are being used by the PrintPropertyDictionary and optionally releases the managed resources.

Dispose()

釋放 PrintPropertyDictionary 正在使用的所有資源。Releases all the resources that are being used by the PrintPropertyDictionary.

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

實作

備註

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

注意

在您釋放最後一個 Dispose() 參考之前,請務必呼叫 PrintPropertyDictionaryAlways call Dispose() before you release your last reference to the PrintPropertyDictionary. 否則,在垃圾收集行程呼叫物件的方法之前,將不會釋放它所使用的資源 Finalize PrintPropertyDictionaryOtherwise, the resources that it is using will not be freed until the garbage collector calls the Finalize method of the PrintPropertyDictionary object.

適用於

Dispose(Boolean)

釋放 PrintPropertyDictionary 正在使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。Releases the unmanaged resources that are being used by the PrintPropertyDictionary and optionally releases the managed resources.

protected:
 virtual void Dispose(bool A_0);
protected:
 virtual void Dispose(bool );
protected virtual void Dispose (bool A_0);
protected virtual void Dispose (bool );
abstract member Dispose : bool -> unit
override this.Dispose : bool -> unit
abstract member Dispose : bool -> unit
override this.Dispose : bool -> unit
Protected Overridable Sub Dispose (A_0 As Boolean)
Protected Overridable Sub Dispose ( As Boolean)

參數

A_0
Boolean

true 表示釋放 Managed 和 Unmanaged 資源,false 則表示只釋放 Unmanaged 資源。true to release both managed and unmanaged resources; false to release only unmanaged resources.

備註

公用方法和方法會呼叫這個方法 Dispose() FinalizeThis method is called by the public Dispose() method and the Finalize method. Dispose() 叫用受保護的 Dispose(Boolean) 方法,並將未命名的布林值參數設定為 trueDispose() invokes the protected Dispose(Boolean) method with the unnamed Boolean parameter set to true. FinalizeDispose(Boolean)使用設定為的參數叫用 falseFinalize invokes Dispose(Boolean) with the parameter set to false.

當布林值參數為時 true ,這個方法會釋放此參考之任何 managed 物件所持有的所有資源 PrintPropertyDictionaryWhen the Boolean parameter is true, this method releases all the resources that are held by any managed objects that this PrintPropertyDictionary references. 這個方法會叫用每個參考物件的 Dispose() 方法。This method invokes the Dispose() method of each referenced object.

給繼承者的注意事項

Dispose 可以被其他物件呼叫多次。 Dispose can be called multiple times by other objects. 當您覆寫時 Dispose(Boolean) ,請小心不要參考先前在先前的呼叫中處置過的物件 DisposeWhen you override Dispose(Boolean), be careful not to reference objects that have been previously disposed of in an earlier call to Dispose. 如需如何執行的詳細資訊 Dispose(Boolean) ,請參閱實 [處置方法](/dotnet/standard/garbage-collection/implementing-dispose)。For more information about how to implement Dispose(Boolean), see [Implementing a Dispose Method](/dotnet/standard/garbage-collection/implementing-dispose).

如需和的詳細資訊 Dispose Finalize() ,請參閱 清除非受控資源 和覆 寫 Finalize 方法For more information about Dispose and Finalize(), see Cleaning Up Unmanaged Resources and Overriding the Finalize Method.

適用於