mscorlib(4.0.0.0) API with additions
System.Threading.ExecutionContext Class Reference

Manages the execution context for the current thread. This class cannot be inherited. More...

Inheritance diagram for System.Threading.ExecutionContext:
[legend]
Collaboration diagram for System.Threading.ExecutionContext:
[legend]

Public Member Functions

void Dispose ()
 Releases all resources used by the current instance of the T:System.Threading.ExecutionContext class. More...
 
ExecutionContext CreateCopy ()
 Creates a copy of the current execution context. More...
 
void GetObjectData (SerializationInfo info, StreamingContext context)
 Sets the specified T:System.Runtime.Serialization.SerializationInfo object with the logical context information needed to recreate an instance of the current execution context. More...
 

Static Public Member Functions

static void Run (ExecutionContext executionContext, ContextCallback callback, object state)
 Runs a method in a specified execution context on the current thread. More...
 
static AsyncFlowControl SuppressFlow ()
 Suppresses the flow of the execution context across asynchronous threads. More...
 
static void RestoreFlow ()
 Restores the flow of the execution context across asynchronous threads. More...
 
static bool IsFlowSuppressed ()
 Indicates whether the flow of the execution context is currently suppressed. More...
 
static ExecutionContext Capture ()
 Captures the execution context from the current thread. More...
 

Detailed Description

Manages the execution context for the current thread. This class cannot be inherited.

Definition at line 14 of file ExecutionContext.cs.

Member Function Documentation

◆ Capture()

static ExecutionContext System.Threading.ExecutionContext.Capture ( )
static

Captures the execution context from the current thread.

Returns
An T:System.Threading.ExecutionContext object representing the execution context for the current thread.

Definition at line 686 of file ExecutionContext.cs.

◆ CreateCopy()

ExecutionContext System.Threading.ExecutionContext.CreateCopy ( )

Creates a copy of the current execution context.

Returns
An T:System.Threading.ExecutionContext object representing the current execution context.
Exceptions
T:System.InvalidOperationExceptionThis context cannot be copied because it is used. Only newly captured contexts can be copied.

Definition at line 595 of file ExecutionContext.cs.

◆ Dispose()

void System.Threading.ExecutionContext.Dispose ( )

Releases all resources used by the current instance of the T:System.Threading.ExecutionContext class.

Implements System.IDisposable.

Definition at line 443 of file ExecutionContext.cs.

◆ GetObjectData()

void System.Threading.ExecutionContext.GetObjectData ( SerializationInfo  info,
StreamingContext  context 
)

Sets the specified T:System.Runtime.Serialization.SerializationInfo object with the logical context information needed to recreate an instance of the current execution context.

Parameters
infoThe T:System.Runtime.Serialization.SerializationInfo object to be populated with serialization information.
contextThe T:System.Runtime.Serialization.StreamingContext structure representing the destination context of the serialization.
Exceptions
T:System.ArgumentNullExceptioninfo is null.

Implements System.Runtime.Serialization.ISerializable.

Definition at line 756 of file ExecutionContext.cs.

◆ IsFlowSuppressed()

static bool System.Threading.ExecutionContext.IsFlowSuppressed ( )
static

Indicates whether the flow of the execution context is currently suppressed.

Returns
true if the flow is suppressed; otherwise, false.

Definition at line 676 of file ExecutionContext.cs.

◆ RestoreFlow()

static void System.Threading.ExecutionContext.RestoreFlow ( )
static

Restores the flow of the execution context across asynchronous threads.

Exceptions
T:System.InvalidOperationExceptionThe context flow cannot be restored because it is not being suppressed.

Definition at line 663 of file ExecutionContext.cs.

◆ Run()

static void System.Threading.ExecutionContext.Run ( ExecutionContext  executionContext,
ContextCallback  callback,
object  state 
)
static

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

Parameters
executionContextThe T:System.Threading.ExecutionContext to set.
callbackA T:System.Threading.ContextCallback delegate that represents the method to be run in the provided execution context.
stateThe object to pass to the callback method.
Exceptions
T:System.InvalidOperationExceptionexecutionContext is null.-or- executionContext was not acquired through a capture operation. -or- executionContext has already been used as the argument to a M:System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,System.Threading.ContextCallback,System.Object) call.

Definition at line 468 of file ExecutionContext.cs.

◆ SuppressFlow()

static AsyncFlowControl System.Threading.ExecutionContext.SuppressFlow ( )
static

Suppresses the flow of the execution context across asynchronous threads.

Returns
An T:System.Threading.AsyncFlowControl structure for restoring the flow.
Exceptions
T:System.InvalidOperationExceptionThe context flow is already suppressed.

Definition at line 649 of file ExecutionContext.cs.


The documentation for this class was generated from the following file: