Skip to content

IReplSessionState

Provides mutable per-session state for command handlers and ambient commands.

public interface IReplSessionState

Clears all values from the session state.

void Clear()

Reads a typed value from the session state.

T? Get<T>(string key)
  • T: Expected value type.

T - The value, or default when not present.

Removes a value from the session state.

bool Remove(string key)

bool - True when a value was removed.

Stores a typed value in the session state.

void Set<T>(string key, T value)
  • T: Value type.
  • key (string): State key.
  • value (T): Value to store.

Tries to read a typed value from the session state.

bool TryGet<T>(string key, out T? value)
  • T: Expected value type.
  • key (string): State key.
  • value (T): Resolved value when present.

bool - True when the key exists and value type matches.