WaitHandle.Close WaitHandle.Close WaitHandle.Close WaitHandle.Close Method


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

 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. 呼叫這個方法來釋放的執行個體所持有的所有資源WaitHandle或衍生的類別。Call 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.