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
keystring
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
pathstring
GetBool(string, bool)
Gets a bool value, returning defaultValue if the key is absent.
public bool GetBool(string key, bool defaultValue = false)
Parameters
Returns
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
Returns
GetDouble(string, double)
Gets a double value, returning defaultValue if the key is absent.
public double GetDouble(string key, double defaultValue = 0)
Parameters
Returns
GetInt(string, int)
Gets an int value, returning defaultValue if the key is absent.
public int GetInt(string key, int defaultValue = 0)
Parameters
Returns
GetKeys()
Returns the direct (non-recursive) leaf value key names of this section node.
public IReadOnlyList<string> GetKeys()
Returns
GetString(string, string)
Gets a string value, returning defaultValue if the key is absent.
public string GetString(string key, string defaultValue = "")
Parameters
Returns
GetSubSectionNames()
Returns the direct child section names of this section node.
public IReadOnlyList<string> GetSubSectionNames()
Returns
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
keystringdefaultValueTtypeInfoJsonTypeInfo<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
keystring
Returns
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
pathstring
Returns
SetBool(string, bool)
Sets a bool value.
public void SetBool(string key, bool value)
Parameters
SetDateTime(string, DateTime)
Sets a DateTime value, stored as ISO 8601 round-trip format.
public void SetDateTime(string key, DateTime value)
Parameters
SetDouble(string, double)
Sets a double value.
public void SetDouble(string key, double value)
Parameters
SetInt(string, int)
Sets an int value.
public void SetInt(string key, int value)
Parameters
SetString(string, string)
Sets a string value.
public void SetString(string key, string value)
Parameters
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
keystringvalueTtypeInfoJsonTypeInfo<T>
Type Parameters
T