UdpClient.Dispose UdpClient.Dispose UdpClient.Dispose UdpClient.Dispose Method

定義

多載

Dispose() Dispose() Dispose() Dispose()

釋放 UdpClient 使用的受控與非受控資源。Releases the managed and unmanaged resources used by the UdpClient.

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

釋放 UdpClient 所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。Releases the unmanaged resources used by the UdpClient and optionally releases the managed resources.

Dispose() Dispose() Dispose() Dispose()

釋放 UdpClient 使用的受控與非受控資源。Releases the managed and unmanaged resources used by the UdpClient.

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

實作

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

釋放 UdpClient 所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。Releases the unmanaged resources used by the UdpClient and optionally releases 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 Boolean Boolean Boolean

true 表示釋放 Managed 和 Unmanaged 資源,false 則表示只釋放 Unmanaged 資源。true to release both managed and unmanaged resources; false to release only unmanaged resources.

備註

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

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

給繼承者的注意事項

Dispose 可以被其他物件呼叫多次。 Dispose can be called multiple times by other objects. 當覆Dispose(Boolean)寫時, 請小心不要參考先前已在先前的Dispose呼叫中處置過的物件。When overriding Dispose(Boolean) be careful not to reference objects that have been previously disposed of in an earlier call to Dispose. 如需如何執行Dispose(Boolean)的詳細資訊, 請參閱執行 Dispose 方法For more information about how to implement Dispose(Boolean), see Implementing a Dispose Method.

如需DisposeFinalize()的詳細資訊, 請參閱清除非受控資源和覆寫 Finalize 方法For more information about Dispose and Finalize(), see Cleaning Up Unmanaged Resources and Overriding the Finalize Method.

適用於