This module provides an observable dictionary implementation for managing application settings. The SettingsCollection<TKey, TItem> class wraps a standard Dictionary<TKey, TItem> and raises events when items are added, removed, modified, or when the collection is cleared. This enables consumers to react to configuration changes in real-time. The module exists to provide change-notification semantics for settings management, allowing dependent components to synchronize state when settings are mutated.
2. Public Interface
SettingsCollection<TKey, TItem>
A generic dictionary implementation that implements IDictionary<TKey, TItem> with change notification support.
Fired after any mutation operation (add, remove, modify, clear) on the collection.
Methods
Signature
Description
void Add(TKey key, TItem value)
Adds a key-value pair to the collection and fires CollectionItemPropertyChanged with ChangeSettingType.Add.
void Add(KeyValuePair<TKey, TItem> item)
Adds a key-value pair via KeyValuePair and fires CollectionItemPropertyChanged with ChangeSettingType.Add.
bool Remove(TKey key)
Removes the item with the specified key. Returns true if removed; fires CollectionItemPropertyChanged with ChangeSettingType.Remove only on successful removal.
bool Remove(KeyValuePair<TKey, TItem> item)
Removes by key (value is ignored). Returns true if removed; fires CollectionItemPropertyChanged with ChangeSettingType.Remove only on successful removal.
void Clear()
Clears all items and fires CollectionItemPropertyChanged with `ChangeSetting