BotState.ClearStateAsync(ITurnContext, CancellationToken) Method

Definition

Clears the state cache for this BotState.

public virtual System.Threading.Tasks.Task ClearStateAsync (Microsoft.Bot.Builder.ITurnContext turnContext, System.Threading.CancellationToken cancellationToken = default);
abstract member ClearStateAsync : Microsoft.Bot.Builder.ITurnContext * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.ClearStateAsync : Microsoft.Bot.Builder.ITurnContext * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function ClearStateAsync (turnContext As ITurnContext, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

turnContext
ITurnContext

The context object for this turn.

cancellationToken
CancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns

A task that represents the work queued to execute.

Exceptions

turnContext is null.

Remarks

This method clears the state cache in the turn context. Call SaveChangesAsync(ITurnContext, Boolean, CancellationToken) to persist this change in the storage layer.

Applies to