PersistentComponentState.TryTakeFromJson<TValue>(String, TValue) Method

Definition

Tries to retrieve the persisted state as JSON with the given key and deserializes it into an instance of type TValue. When the key is present, the state is successfully returned via instance and removed from the PersistentComponentState.

C#
public bool TryTakeFromJson<TValue> (string key, out TValue? instance);

Type Parameters

TValue

Parameters

key
String

The key used to persist the instance.

instance
TValue

The persisted instance.

Returns

true if the state was found; false otherwise.

Applies to

Product Versions
ASP.NET Core 6.0, 7.0, 8.0, 9.0