Beispiel #1
0
        public ConfigurationSettingProperty
        (
            string key,
            IConfigurationSettingProperty source,
            ISettings storage
        )
        {
            Key       = key;
            ValueType = source.ValueType;

            _default = source;

            _storage = storage.ThrowIfNull(nameof(storage));
        }
Beispiel #2
0
        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));
        }