WebResponse.Dispose 方法
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
釋放 WebResponse 物件所使用的資源。
Dispose() |
釋放由 WebResponse 物件使用的 Unmanaged 資源。 |
Dispose(Boolean) |
釋放 WebResponse 物件所使用的 Unmanaged 資源,並選擇性處置 Managed 資源。 |
釋放由 WebResponse 物件使用的 Unmanaged 資源。
public:
virtual void Dispose();
public void Dispose();
abstract member Dispose : unit -> unit
override this.Dispose : unit -> unit
Public Sub 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 |
釋放 WebResponse 物件所使用的 Unmanaged 資源,並選擇性處置 Managed 資源。
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 資源。
備註
如果已覆寫這個方法,則由公用 Dispose()
方法和 Finalize() 方法呼叫。
Dispose()
叫用這個方法, disposing
並將 參數設定為 true
。
Finalize
叫用這個方法,並將 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 |