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 ()

備註

這個方法是 WaitHandle 類別及其衍生類別的 IDisposable.Dispose 方法的公用實作為。This method is the public implementation of the IDisposable.Dispose method for the WaitHandle class and its derived classes. 它提供了標準的執行,可使用 true 引數呼叫 @no__t 0 多載,然後再呼叫 @no__t 2 方法。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.

注意

在您釋放 WaitHandle 的最後一個參考之前,請一律呼叫 CloseDispose()Always 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.

適用於

另請參閱