Interface IDefiningConfigKey<T>
- Namespace
- MonkeyLoader.Configuration
- Assembly
- MonkeyLoader.dll
Defines the typed definition for a config item.
public interface IDefiningConfigKey<T> : IDefiningConfigKey, IEntity<IDefiningConfigKey>, IEnumerable<IComponent<IDefiningConfigKey>>, INestedIdentifiable<ConfigSection>, INestedIdentifiable, IPrioritizable, IDisplayable, ITypedConfigKey<T>, ITypedConfigKey, IConfigKey, IEquatable<IConfigKey>, IIdentifiable, IEntity<IDefiningConfigKey<T>>, IEnumerable<IComponent<IDefiningConfigKey<T>>>, IEnumerable
Type Parameters
TThe type of the config item's value.
- Inherited Members
- Extension Methods
Methods
GetValue()
Gets this config item's set value, falling back to the computed default.
T? GetValue()
Returns
- T
The item's internal value or its type's
default.
SetValue(T, string?)
Set the config item's internal value to the given one.
void SetValue(T value, string? eventLabel = null)
Parameters
valueTThe value to set.
eventLabelstringThe custom label that may be set by whoever changed the config.
Exceptions
- ArgumentException
Tthe
valuedidn't pass validation.
TryComputeDefault(out T?)
Tries to compute the default value for this key, if a default provider was set.
bool TryComputeDefault(out T? defaultValue)
Parameters
defaultValueTThe computed default value if the return value is
true. Otherwisedefault.
Returns
- bool
trueif the default value was successfully computed.
TryGetValue(out T?)
Tries to get this config item's set value, falling back to the computed default.
bool TryGetValue(out T? value)
Parameters
valueTThe item's internal value or its type's
default.
Returns
- bool
trueif the config item's value was set or a default could be computer, otherwisefalse.
TrySetValue(T, string?)
Tries to set the config item's internal value to the given one if it passes validation.
bool TrySetValue(T value, string? eventLabel = null)
Parameters
valueTThe value to set.
eventLabelstringThe custom label that may be set by whoever changed the config.
Returns
- bool
trueif the value was successfully set, otherwisefalse.
Validate(T)
Checks if a value is valid for this config item.
bool Validate(T value)
Parameters
valueTThe value to check.
Returns
- bool
trueif the value is valid.
Events
Changed
Triggered when the internal value of this config item changes.
event ConfigKeyChangedEventHandler<T>? Changed