HttpWebResponse.Dispose(Boolean) 方法

定義

釋放 HttpWebResponse 所使用的 Unmanaged 資源,並選擇性處置 Managed 資源。

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

參數

disposing
Boolean

true 表示會同時釋放 Managed 和 Unmanaged 資源;false 則表示只釋放 Unmanaged 資源。

備註

如果已覆寫此方法,則由公用 Dispose() 方法和 Finalize() 方法呼叫。 Dispose() 叫用這個方法, disposing 並將 參數設定為 trueFinalize 會叫用這個方法,並將 disposing 設定為 false

disposing 參數為 true 時,這個方法會釋放 WebResponse 參考的任何 Managed 物件所掌握的資源。 這個方法會叫用每個參考物件的 Dispose() 方法。

注意

在應用程式中啟用網路追蹤時,這個成員會輸出追蹤資訊。 如需詳細資訊,請參閱 .NET Framework 中的網路追蹤

給繼承者的注意事項

Dispose 可以被其他物件呼叫多次。 覆寫 Dispose(Boolean) 時,請小心不要參考到先前已在對 Dispose 的早期呼叫中被處置 (Dispose) 的物件。 如需如何實 Dispose(Boolean)作 的詳細資訊,請參閱 實作 Dispose 方法

如需 和 Finalize()的詳細資訊Dispose,請參閱清除 Unmanaged 資源覆寫 Finalize 方法

適用於