Interface ISaveState
Defines a contract for saving and loading the state of an object. The state must be JSON serializable.
public interface ISaveState
Methods
DefaultSaveStateAsync()
public static ValueTask<JsonElement> DefaultSaveStateAsync()
Returns
LoadStateAsync(JsonElement)
Loads a previously saved state into the object.
ValueTask LoadStateAsync(JsonElement state)
Parameters
state
JsonElementA dictionary representing the saved state. The structure of the state is implementation-defined but must be JSON serializable.
Returns
- ValueTask
A task representing the asynchronous operation.
SaveStateAsync()
Saves the current state of the object.
ValueTask<JsonElement> SaveStateAsync()
Returns
- ValueTask<JsonElement>
A task representing the asynchronous operation, returning a dictionary containing the saved state. The structure of the state is implementation-defined but must be JSON serializable.