IActorStateManager.TryGetStateAsync<T> 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.
Attempts to get an actor state with specified state name.
public System.Threading.Tasks.Task<Microsoft.ServiceFabric.Data.ConditionalValue<T>> TryGetStateAsync<T> (string stateName, System.Threading.CancellationToken cancellationToken = default);
abstract member TryGetStateAsync : string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.ServiceFabric.Data.ConditionalValue<'T>>
Public Function TryGetStateAsync(Of T) (stateName As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ConditionalValue(Of T))
Type Parameters
- T
Type of value associated with given state name.
Parameters
- stateName
- String
Name of the actor state to get.
- cancellationToken
- CancellationToken
The token to monitor for cancellation requests.
Returns
A task that represents the asynchronous get operation. The value of TResult parameter contains ConditionalValue<TValue> indicating whether the actor state is present and the value of actor state if it is present.
Exceptions
The specified state name is null.
The operation was canceled.
Remarks
The type of state value T
must be Data Contract serializable.