Editare

Partajați prin


WaitHandle.Dispose Method

Definition

Releases all resources used by the current instance of the WaitHandle class.

Overloads

Dispose()

Releases all resources used by the current instance of the WaitHandle class.

Dispose(Boolean)

When overridden in a derived class, releases the unmanaged resources used by the WaitHandle, and optionally releases the managed resources.

Dispose()

Source:
WaitHandle.cs
Source:
WaitHandle.cs
Source:
WaitHandle.cs

Releases all resources used by the current instance of the WaitHandle class.

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

Implements

Remarks

This method is equivalent to the Close method.

Note

Always call Close or Dispose() before you release your last reference to the WaitHandle. Otherwise, the resources it is using will not be freed.

See also

Applies to

Dispose(Boolean)

Source:
WaitHandle.cs
Source:
WaitHandle.cs
Source:
WaitHandle.cs

When overridden in a derived class, releases the unmanaged resources used by the WaitHandle, and optionally releases the managed resources.

protected:
 virtual void Dispose(bool explicitDisposing);
protected virtual void Dispose (bool explicitDisposing);
abstract member Dispose : bool -> unit
override this.Dispose : bool -> unit
Protected Overridable Sub Dispose (explicitDisposing As Boolean)

Parameters

explicitDisposing
Boolean

true to release both managed and unmanaged resources; false to release only unmanaged resources.

Remarks

This method is called by the Close and the Dispose() methods with the explicitDisposing parameter set to true. When the explicitDisposing parameter is true, this method releases all resources held by any managed objects that this WaitHandle object references.

Notes to Inheritors

You should override the Dispose(Boolean) method to release resources allocated in derived classes.

The Close() or Dispose() method can be called multiple times by other objects. When overriding this method, be careful not to reference objects that have been previously disposed in an earlier call to Dispose or Close.

See also

Applies to