Share via


IStatePropertyAccessor<T>.GetAsync Method

Definition

Gets the property value from the source.

public System.Threading.Tasks.Task<T> GetAsync (Microsoft.Bot.Builder.ITurnContext turnContext, Func<T> defaultValueFactory = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetAsync : Microsoft.Bot.Builder.ITurnContext * Func<'T> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'T>
Public Function GetAsync (turnContext As ITurnContext, Optional defaultValueFactory As Func(Of T) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of T)

Parameters

turnContext
ITurnContext

Turn Context.

defaultValueFactory
Func<T>

Function which defines the property value to be returned if no value has been set.

cancellationToken
CancellationToken

The cancellation token.

Returns

Task<T>

A Task representing the result of the asynchronous operation.

Exceptions

The property has no value and no defaultValueFactory.

Applies to