HttpWebResponse.IDisposable.Dispose 方法

定義

釋放 HttpWebResponse 所使用的所有資源。Releases all resources used by the HttpWebResponse.

此 API 支援此產品基礎結構,但無法直接用於程式碼之中。

 virtual void System.IDisposable.Dispose() = IDisposable::Dispose;
void IDisposable.Dispose ();
override this.System.IDisposable.Dispose : unit -> unit
abstract member System.IDisposable.Dispose : unit -> unit
override this.System.IDisposable.Dispose : unit -> unit
Sub Dispose () Implements IDisposable.Dispose

實作

備註

Dispose 使用完畢時,請呼叫 HttpWebResponseCall Dispose when you are finished using the HttpWebResponse. Dispose 方法會將 HttpWebResponse 保留在無法使用的狀態。The Dispose method leaves the HttpWebResponse in an unusable state. 在呼叫之後 Dispose ,您必須釋放所有對的參考, HttpWebResponse 讓垃圾收集行程可以回收所佔用的記憶體 HttpWebResponseAfter calling Dispose, you must release all references to the HttpWebResponse so the garbage collector can reclaim the memory that the HttpWebResponse was occupying. 如需詳細資訊,請參閱 清除非受控資源執行處置方法For more information, see Cleaning Up Unmanaged Resources and Implementing a Dispose Method.

注意

在您釋放最後一個 Dispose 參考之前,請務必呼叫 HttpWebResponseAlways call Dispose before you release your last reference to the HttpWebResponse. 否則工作窗格所使用的資源不會釋放,直到記憶體回收行程呼叫 HttpWebResponse 物件的 Finalize 方法。Otherwise, the resources it is using will not be freed until the garbage collector calls the HttpWebResponse object's Finalize method.

適用於