Επεξεργασία

Κοινή χρήση μέσω


HostExecutionContext.Dispose Method

Definition

Releases resources used by the current instance of the HostExecutionContext class.

Overloads

Dispose()

Releases all resources used by the current instance of the HostExecutionContext 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:
HostExecutionContext.cs
Source:
HostExecutionContext.cs
Source:
HostExecutionContext.cs

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

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

Implements

Remarks

Call Dispose when you are finished using the HostExecutionContext. The Dispose method leaves the HostExecutionContext in an unusable state. After calling Dispose, you must release all references to the HostExecutionContext so the garbage collector can reclaim the memory that the HostExecutionContext was occupying.

For more information, see Cleaning Up Unmanaged Resources and Implementing a Dispose Method.

Note

Always call Dispose before you release your last reference to the HostExecutionContext. Otherwise, the resources it is using will not be freed until the garbage collector calls the HostExecutionContext object's Finalize method.

See also

Applies to

Dispose(Boolean)

Source:
HostExecutionContext.cs
Source:
HostExecutionContext.cs
Source:
HostExecutionContext.cs

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

public:
 virtual void Dispose(bool disposing);
public virtual void Dispose (bool disposing);
abstract member Dispose : bool -> unit
override this.Dispose : bool -> unit
Public Overridable Sub Dispose (disposing As Boolean)

Parameters

disposing
Boolean

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

Remarks

This method is called by the Dispose() method overload and the finalizer. Dispose() invokes this protected method with the disposing parameter set to true. The finalizer invokes this method with disposing set to false.

When the disposing parameter is true, this method releases all resources held by any managed objects that this HostExecutionContext references. This method invokes the Dispose method of each referenced object.

This 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.

Applies to