HostExecutionContextManager.SetHostExecutionContext Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets the current host execution context to the specified host execution context.
public:
virtual System::Object ^ SetHostExecutionContext(System::Threading::HostExecutionContext ^ hostExecutionContext);
public virtual object SetHostExecutionContext (System.Threading.HostExecutionContext hostExecutionContext);
[System.Security.SecurityCritical]
public virtual object SetHostExecutionContext (System.Threading.HostExecutionContext hostExecutionContext);
abstract member SetHostExecutionContext : System.Threading.HostExecutionContext -> obj
override this.SetHostExecutionContext : System.Threading.HostExecutionContext -> obj
[<System.Security.SecurityCritical>]
abstract member SetHostExecutionContext : System.Threading.HostExecutionContext -> obj
override this.SetHostExecutionContext : System.Threading.HostExecutionContext -> obj
Public Overridable Function SetHostExecutionContext (hostExecutionContext As HostExecutionContext) As Object
Parameters
- hostExecutionContext
- HostExecutionContext
The HostExecutionContext to be set.
Returns
An object for restoring the HostExecutionContext to its previous state.
- Attributes
Exceptions
hostExecutionContext
was not acquired through a capture operation.
-or-
hostExecutionContext
has been the argument to a previous SetHostExecutionContext(HostExecutionContext) method call.
Remarks
The SetHostExecutionContext method sets the host execution context for the current HostExecutionContext. A HostExecutionContext that has been used as the argument to another SetHostExecutionContext method call cannot be passed in as the parameter for this method. Instead, use the HostExecutionContext.CreateCopy method to create a copy of a HostExecutionContext object and then use the copy to set the host execution context.
Call the Revert method using the object returned by this method to restore the HostExecutionContext to its previous state.
Applies to
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈