ExecutionContext.Run(ExecutionContext, ContextCallback, Object) ExecutionContext.Run(ExecutionContext, ContextCallback, Object) ExecutionContext.Run(ExecutionContext, ContextCallback, Object) Method

Definition

Runs a method in a specified execution context on the current thread.

public:
 static void Run(System::Threading::ExecutionContext ^ executionContext, System::Threading::ContextCallback ^ callback, System::Object ^ state);
[System.Security.SecurityCritical]
public static void Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state);
static member Run : System.Threading.ExecutionContext * System.Threading.ContextCallback * obj -> unit

Parameters

callback
ContextCallback ContextCallback ContextCallback

A ContextCallback delegate that represents the method to be run in the provided execution context.

state
Object Object Object

The object to pass to the callback method.

Exceptions

executionContext is null.

-or-

executionContext was not acquired through a capture operation.

-or-

executionContext has already been used as the argument to a Run(ExecutionContext, ContextCallback, Object) call.

Remarks

The execution context is returned to its previous state when the method completes.

Security

SecurityCriticalAttribute
Requires full trust for the immediate caller. This member cannot be used by partially trusted or transparent code.

Applies to