語言

IAsyncState 介面

定義

將非同步流程中的所有資訊封裝在變 AsyncLocal<T> 數中。 此介面的某些實作可能不具備執行緒安全。

public interface class IAsyncState
public interface IAsyncState
type IAsyncState = interface
Public Interface IAsyncState

方法

名稱 Description
Get(AsyncStateToken)

從狀態取得儲存的非同步上下文。

Initialize()

初始化當前非同步流程中的非同步狀態。

RegisterAsyncContext()

會將新的非同步上下文與狀態註冊。

Reset()

使用後重置非同步狀態。

Set(AsyncStateToken, Object)

儲存非同步上下文。

TryGet(AsyncStateToken, Object)

嘗試從狀態取得儲存的非同步上下文。

適用於