Table of Contents

Class RegistrySection

Namespace
SharpConsoleUI.Registry
Assembly
SharpConsoleUI.dll

A live view of a node in the registry tree. Provides typed get/set for primitive types, AOT-safe generic types, and sub-section navigation. RegistrySection is a lightweight wrapper — it holds no independent state beyond a reference to its JsonObject node and the parent AppRegistry (for flush callbacks).

Thread-safety note: RegistrySection instances are NOT individually thread-safe. Do not share a single RegistrySection instance across threads without external synchronization.

public class RegistrySection
Inheritance
RegistrySection
Inherited Members
Extension Methods

Methods

DeleteKey(string)

Removes a leaf value key. No-op if the key does not exist.

public void DeleteKey(string key)

Parameters

key string

DeleteSection(string)

Removes a direct child section subtree at the given relative path. No-op if any part of the path does not exist.

public void DeleteSection(string path)

Parameters

path string

GetBool(string, bool)

Gets a bool value, returning defaultValue if the key is absent.

public bool GetBool(string key, bool defaultValue = false)

Parameters

key string
defaultValue bool

Returns

bool

GetDateTime(string, DateTime)

Gets a DateTime value stored as ISO 8601, returning defaultValue if the key is absent.

public DateTime GetDateTime(string key, DateTime defaultValue = default)

Parameters

key string
defaultValue DateTime

Returns

DateTime

GetDouble(string, double)

Gets a double value, returning defaultValue if the key is absent.

public double GetDouble(string key, double defaultValue = 0)

Parameters

key string
defaultValue double

Returns

double

GetInt(string, int)

Gets an int value, returning defaultValue if the key is absent.

public int GetInt(string key, int defaultValue = 0)

Parameters

key string
defaultValue int

Returns

int

GetKeys()

Returns the direct (non-recursive) leaf value key names of this section node.

public IReadOnlyList<string> GetKeys()

Returns

IReadOnlyList<string>

GetString(string, string)

Gets a string value, returning defaultValue if the key is absent.

public string GetString(string key, string defaultValue = "")

Parameters

key string
defaultValue string

Returns

string

GetSubSectionNames()

Returns the direct child section names of this section node.

public IReadOnlyList<string> GetSubSectionNames()

Returns

IReadOnlyList<string>

Get<T>(string, T, JsonTypeInfo<T>)

Gets a value of type T using a source-generated JsonTypeInfo (AOT-safe). Returns defaultValue if the key is absent or deserialization fails.

public T Get<T>(string key, T defaultValue, JsonTypeInfo<T> typeInfo)

Parameters

key string
defaultValue T
typeInfo JsonTypeInfo<T>

Returns

T

Type Parameters

T

HasKey(string)

Returns true if the given key exists as a direct leaf value in this section.

public bool HasKey(string key)

Parameters

key string

Returns

bool

OpenSection(string)

Opens a sub-section by relative path. Creates intermediate nodes as needed. '/' is the path separator. Leading/trailing slashes are trimmed. Empty path or "/" returns this section. Double slashes throw ArgumentException.

public RegistrySection OpenSection(string path)

Parameters

path string

Returns

RegistrySection

SetBool(string, bool)

Sets a bool value.

public void SetBool(string key, bool value)

Parameters

key string
value bool

SetDateTime(string, DateTime)

Sets a DateTime value, stored as ISO 8601 round-trip format.

public void SetDateTime(string key, DateTime value)

Parameters

key string
value DateTime

SetDouble(string, double)

Sets a double value.

public void SetDouble(string key, double value)

Parameters

key string
value double

SetInt(string, int)

Sets an int value.

public void SetInt(string key, int value)

Parameters

key string
value int

SetString(string, string)

Sets a string value.

public void SetString(string key, string value)

Parameters

key string
value string

Set<T>(string, T, JsonTypeInfo<T>)

Sets a value of type T using a source-generated JsonTypeInfo (AOT-safe).

public void Set<T>(string key, T value, JsonTypeInfo<T> typeInfo)

Parameters

key string
value T
typeInfo JsonTypeInfo<T>

Type Parameters

T