Interface ISettingsBundle
A collection of settings groups, which belongs to a settings hierarchy.
Namespace: Sdl.Core.Settings
Assembly: Sdl.Core.Settings.dll
Syntax
public interface ISettingsBundle
Properties
IsDefault
Returns true if this settings bundle defines default settings.
Declaration
bool IsDefault { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsEmpty
True if all settings groups in the setting bundle are empty.
Declaration
bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Parent
The settings bundle the groups within inherit from or null if this is a top level bundle.
Declaration
ISettingsBundle Parent { get; set; }
Property Value
Type | Description |
---|---|
ISettingsBundle |
Methods
AddSettingsGroup(ISettingsGroup)
Adds an existing settings group to the Settings Bundle - the given group must not already be part of the Settings Bundle.
Declaration
bool AddSettingsGroup(ISettingsGroup settingsGroup)
Parameters
Type | Name | Description |
---|---|---|
ISettingsGroup | settingsGroup |
Returns
Type | Description |
---|---|
System.Boolean | true if the SettingsGroup was successfully added, false otherwise |
Assign(ISettingsBundle)
Assigns existing setting to a new setting bundle.
Declaration
void Assign(ISettingsBundle settings)
Parameters
Type | Name | Description |
---|---|---|
ISettingsBundle | settings | The settings. |
ContainsSettingsGroup(String)
Returns true if this group exists in the current bundle (searches the ancestor chain as well)
Declaration
bool ContainsSettingsGroup(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The id of the settings group to check for |
Returns
Type | Description |
---|---|
System.Boolean | true if this group exists in the current or any ancestor bundle |
GetSettingsGroup(String)
Provides untyped access to a settings group by ID.
Declaration
ISettingsGroup GetSettingsGroup(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The ID of the settings group to retrieve. |
Returns
Type | Description |
---|---|
ISettingsGroup | The settings group, or null if no relevant settings group type could be found. |
Remarks
Creates a new instance of the settings group if it does not exist within this bundle yet.
GetSettingsGroup<T>()
Generic method to return a strongly typed instance of ISettingsGroup representing a single type of group, using the type's name as the unique id. The class must implement ISettingsGroup and have a default constructor.
Declaration
T GetSettingsGroup<T>()
where T : ISettingsGroup, new()
Returns
Type | Description |
---|---|
T | An instance of the settings group, or null if no suitable type found |
Type Parameters
Name | Description |
---|---|
T | The type of group to instantiate |
GetSettingsGroup<T>(String)
Get a strongly typed settings group class by ID.
Declaration
T GetSettingsGroup<T>(string id)
where T : ISettingsGroup, new()
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The ID of the settings group to retrieve. |
Returns
Type | Description |
---|---|
T | An instance of the type, or null if no relevant settings group type could be found |
Type Parameters
Name | Description |
---|---|
T | The static type to retrieve |
Remarks
Creates a new instance of the settings group if it does not exist within this bundle yet.
GetSettingsGroupIds()
The IDs of all settings groups currently contained in this settings bundle and any ancestors.
Declaration
IEnumerable<string> GetSettingsGroupIds()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.String> | The IDs of all settings groups contained in the settings bundle, including parent bundles. |
RemoveSettingsGroup(String)
Removes the settings group with the provided ID from this settings bundle.
Declaration
void RemoveSettingsGroup(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The ID of the settings group to remove. |
Reset()
Resets all settings locally defined in this settings bundle.
Declaration
void Reset()