WebResponse.Dispose 方法

定義

釋放 WebResponse 物件所使用的資源。Releases the resources used by the WebResponse object.

多載

Dispose()

釋放由 WebResponse 物件使用的 Unmanaged 資源。Releases the unmanaged resources used by the WebResponse object.

Dispose(Boolean)

釋放 WebResponse 物件所使用的 Unmanaged 資源,並選擇性處置 Managed 資源。Releases the unmanaged resources used by the WebResponse object, and optionally disposes of the managed resources.

Dispose()

釋放由 WebResponse 物件使用的 Unmanaged 資源。Releases the unmanaged resources used by the WebResponse object.

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

實作

適用於

Dispose(Boolean)

釋放 WebResponse 物件所使用的 Unmanaged 資源,並選擇性處置 Managed 資源。Releases the unmanaged resources used by the WebResponse object, and optionally disposes of 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 releases only unmanaged resources.

備註

這個方法是由公用 Dispose() 方法和方法所呼叫 FinalizeThis method is called by the public Dispose() method and the Finalize method. Dispose() 叫用受保護的 Dispose(Boolean) 方法,並將 disposing 參數設定為 trueDispose() invokes the protected Dispose(Boolean) method with the disposing parameter set to true. FinalizeDispose使用設定為的叫用 disposing falseFinalize invokes Dispose with disposing set to false.

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

注意

在應用程式中啟用網路追蹤時,這個成員會輸出追蹤資訊。This member outputs trace information when you enable network tracing in your application. 如需詳細資訊,請參閱 .NET Framework 中的網路追蹤For more information, see Network Tracing in the .NET Framework.

適用於