IReplSessionState
Provides mutable per-session state for command handlers and ambient commands.
- Kind:
Interface - Namespace: Repl
- Assembly:
Repl.Core - Source: src/Repl.Core/IReplSessionState.cs
Signature
Section titled “Signature”public interface IReplSessionStateMethods
Section titled “Methods”Clear()
Section titled “Clear()”Clears all values from the session state.
void Clear()Get<T>(string)
Section titled “Get<T>(string)”Reads a typed value from the session state.
T? Get<T>(string key)Type Parameters
Section titled “Type Parameters”T: Expected value type.
Parameters
Section titled “Parameters”key(string): State key.
Returns
Section titled “Returns”T - The value, or default when not present.
Remove(string)
Section titled “Remove(string)”Removes a value from the session state.
bool Remove(string key)Parameters
Section titled “Parameters”key(string): State key.
Returns
Section titled “Returns”bool - True when a value was removed.
Set<T>(string, T)
Section titled “Set<T>(string, T)”Stores a typed value in the session state.
void Set<T>(string key, T value)Type Parameters
Section titled “Type Parameters”T: Value type.
Parameters
Section titled “Parameters”key(string): State key.value(T): Value to store.
TryGet<T>(string, out T?)
Section titled “TryGet<T>(string, out T?)”Tries to read a typed value from the session state.
bool TryGet<T>(string key, out T? value)Type Parameters
Section titled “Type Parameters”T: Expected value type.
Parameters
Section titled “Parameters”key(string): State key.value(T): Resolved value when present.
Returns
Section titled “Returns”bool - True when the key exists and value type matches.