IActorStateManager.SetStateAsync<T> Method

Definition

Sets an actor state with given state name to specified value. If an actor state with specified name does not exist, it is added.

public System.Threading.Tasks.Task SetStateAsync<T> (string stateName, T value, System.Threading.CancellationToken cancellationToken = default);
abstract member SetStateAsync : string * 'T * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SetStateAsync(Of T) (stateName As String, value As T, Optional cancellationToken As CancellationToken = Nothing) As Task

Type Parameters

T

Type of value associated with given state name.

Parameters

stateName
String

Name of the actor state to set.

value
T

Value of the actor state.

cancellationToken
CancellationToken

The token to monitor for cancellation requests.

Returns

A task that represents the asynchronous set operation.

Exceptions

The specified state name is null.

The operation was canceled.

Remarks

The type of state value T must be Data Contract serializable.

Applies to