public ConfigurationSettingProperty ( string key, IConfigurationSettingProperty source, ISettings storage ) { Key = key; ValueType = source.ValueType; _default = source; _storage = storage.ThrowIfNull(nameof(storage)); }
public ConfigurationSettingProperty ( string key, Type type, object defaultValue, ISettings storage ) { Key = key; ValueType = type.ThrowIfNull(nameof(type)); defaultValue.ThrowIf( v => IsValueOfType(v, type) == false && CanCastValueToType(v, type) == false, nameof(defaultValue), "Type of the default value must be the same as the type of this property."); _default = new ConstantProperty(defaultValue); _storage = storage.ThrowIfNull(nameof(storage)); }