WaitHandle.Close 方法

定義

釋放目前 WaitHandle 所持有的全部資源。Releases all resources held by the current WaitHandle.

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

備註

這個方法是 IDisposable.Dispose WaitHandle 類別及其衍生類別之方法的公用實作為。This method is the public implementation of the IDisposable.Dispose method for the WaitHandle class and its derived classes. 它提供使用引數來呼叫多載的標準執行, Dispose(Boolean) true 然後呼叫 GC.SuppressFinalize 方法。It provides a standard implementation that calls the Dispose(Boolean) overload with a true argument and then calls the GC.SuppressFinalize method. 呼叫這個方法以釋放實例或衍生類別所持有的所有資源 WaitHandleCall this method to release all resources held by an instance of WaitHandle or a derived class.

呼叫這個方法之後,對目前實例的參考會造成未定義的行為。Once this method is called, references to the current instance cause undefined behavior.

注意

Close Dispose() 您釋放最後一個參考之前,請一律呼叫或 WaitHandleAlways call Close or Dispose() before you release your last reference to the WaitHandle. 否則,將不會釋放它所使用的資源。Otherwise, the resources it is using will not be freed.

給繼承者的注意事項

您應該覆寫 Dispose(Boolean) 方法,以釋放在衍生類別中配置的資源。You should override the Dispose(Boolean) method to release resources allocated in derived classes.

適用於