mscorlib 2.0.0.0 4.0.0.0 System.Object System.IDisposable System.Runtime.Serialization.ISerializable

The class provides a single container for all information relevant to a logical thread of execution. This includes security context, call context, and synchronization context.

The class provides the functionality for user code to capture and transfer this context across user-defined asynchronous points. The common language runtime ensures that the is consistently transferred across runtime-defined asynchronous points within the managed process.

An execution context is the managed equivalent of a COM apartment. Within an application domain, the entire execution context must be transferred whenever a thread is transferred. This situation occurs during transfers made by the method, most thread pool operations, and Windows Forms thread marshaling through the Windows message pump. It does not occur in unsafe thread pool operations (such as the method), which do not transfer the compressed stack. Wherever the compressed stack flows, the managed principal, synchronization, locale, and user context also flow. The class provides the and methods to get the execution context and the method to set the execution context for the current thread.

An that is associated with a thread cannot be set on another thread. Attempting to do so will result in an exception being thrown. To propagate the from one thread to another, make a copy of the .

Internally, the stores all data that is associated with the . This allows the data to be propagated when the is copied and transferred.

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

- Method
  2.0.0.0
  4.0.0.0
  System.Threading.ExecutionContext

  The captured execution context can be used as the parameter for the method.

  Captures the execution context from the current thread.

  An object representing the execution context for the current thread.

- Method
  2.0.0.0
  4.0.0.0
  System.Threading.ExecutionContext

  This method is useful for propagating an execution context from one thread to another.

  Creates a copy of the current execution context.

  An object representing the current execution context.

- Method
  4.0.0.0
  System.Void

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

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

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

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

- Method
  2.0.0.0
  4.0.0.0
  System.Void `` ``

  sets a with the logical call context information. During deserialization, the execution context object is reconstituted from the transmitted over the stream.

  For more information, see .

  Sets the specified object with the logical context information needed to recreate an instance of the current execution context.

  The object to be populated with serialization information. The structure representing the destination context of the serialization.
- Method
  2.0.0.0
  4.0.0.0
  System.Boolean

  The method is used by infrastructure components to determine whether to transfer the during asynchronous operations.

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

  true if the flow is suppressed; otherwise, false.

- Method
  2.0.0.0
  4.0.0.0
  System.Void

  reverses the effect of a prior method call.

  This method is called by the method of the structure returned by the method. You should use the method to restore the flow of the execution context, not the method.

  Restores the flow of the execution context across asynchronous threads.

- Method
  2.0.0.0
  4.0.0.0
  System.Void `` `` ``

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

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

  The to set. A delegate that represents the method to be run in the provided execution context. The object to pass to the callback method.
- Method
  2.0.0.0
  4.0.0.0
  System.Threading.AsyncFlowControl

  Use this method to suppress the flow of the on the current thread.

  You must use the method on the returned structure to restore the flow of the .

  This method is protected with a for permission. A fully trusted component can call this method to suppress the flow of the during asynchronous calls. While the flow is suppressed, the method returns null.

  Suppresses the flow of the execution context across asynchronous threads.

  An structure for restoring the flow.