WebResponse.Dispose 方法

定義

釋放 WebResponse 物件所使用的資源。

多載

Dispose()

釋放由 WebResponse 物件使用的 Unmanaged 資源。

Dispose(Boolean)

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

Dispose()

來源:
WebResponse.cs
來源:
WebResponse.cs
來源:
WebResponse.cs

釋放由 WebResponse 物件使用的 Unmanaged 資源。

C#
public void Dispose();

實作

適用於

.NET 10 和其他版本
產品 版本
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

Dispose(Boolean)

來源:
WebResponse.cs
來源:
WebResponse.cs
來源:
WebResponse.cs

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

C#
protected virtual void Dispose(bool disposing);

參數

disposing
Boolean

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

備註

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

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

備註

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

適用於

.NET 10 和其他版本
產品 版本
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0