ResXResourceReader.Dispose(Boolean) 方法


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

 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)



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


這個方法可以透過 IDisposable.Dispose 方法或 Object.Finalize 方法來呼叫。This method can be called by either the IDisposable.Dispose method or the Object.Finalize method. IDisposable.Dispose 會叫用這個方法,並將 disposing 參數設定為 trueIDisposable.Dispose invokes this method with the disposing parameter set to true. Finalize 會叫用這個方法,disposing 設定為 falseFinalize invokes this method with disposing set to false.

disposing 參數為 true 時,這個方法會釋放 ResXResourceReader 參考的任何 Managed 物件所掌握的資源。When the disposing parameter is true, this method releases all resources held by any managed objects that this ResXResourceReader references. 這個方法會叫用每個參考物件的 Dispose 方法。This method invokes the Dispose method of each referenced object.


Dispose 可以被其他物件呼叫多次。 Dispose can be called multiple times by other objects. 覆寫 Dispose(Boolean) 時,請小心不要參考到先前已在對 Dispose 的早期呼叫中被處置 (Dispose) 的物件。When overriding Dispose(Boolean), be careful not to reference objects that have been previously disposed of in an earlier call to Dispose. 如需如何執行 Dispose(Boolean) 和可處置模式的詳細資訊,請參閱[執行 Dispose 方法](~/docs/standard/garbage-collection/、IDisposableFinalize()For more information about how to implement Dispose(Boolean) and about the disposable pattern, see [Implementing a Dispose Method](~/docs/standard/garbage-collection/, IDisposable, and Finalize().