Table of Contents

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, ITypedConfigKey<T>, ITypedConfigKey, IConfigKey, IEquatable<IConfigKey>, IIdentifiable, IEntity<IDefiningConfigKey<T>>, IEnumerable<IComponent<IDefiningConfigKey<T>>>, IEnumerable

Type Parameters

T

The 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

value T

The value to set.

eventLabel string

The custom label that may be set by whoever changed the config.

Exceptions

ArgumentException

Tthe value didn'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

defaultValue T

The computed default value if the return value is true. Otherwise default.

Returns

bool

true if 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

value T

The item's internal value or its type's default.

Returns

bool

true if the config item's value was set or a default could be computer, otherwise false.

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

value T

The value to set.

eventLabel string

The custom label that may be set by whoever changed the config.

Returns

bool

true if the value was successfully set, otherwise false.

Validate(T)

Checks if a value is valid for this config item.

bool Validate(T value)

Parameters

value T

The value to check.

Returns

bool

true if the value is valid.

Events

Changed

Triggered when the internal value of this config item changes.

event ConfigKeyChangedEventHandler<T>? Changed

Event Type

ConfigKeyChangedEventHandler<T>