System.Configuration.ConfigurationValidatorBase.CanValidate C# (CSharp) Метод

CanValidate() публичный Метод

public CanValidate ( Type type ) : bool
type System.Type
Результат bool
        public virtual bool CanValidate(Type type) {
            return false;
        }
        public abstract void Validate(object value);

Usage Example

Пример #1
0
        private void ConstructorInit(
            string name,
            Type type,
            ConfigurationPropertyOptions options,
            ConfigurationValidatorBase validator,
            TypeConverter converter,
            string description)
        {
            if (typeof(ConfigurationSection).IsAssignableFrom(type))
            {
                throw new ConfigurationErrorsException(
                          SR.Format(SR.Config_properties_may_not_be_derived_from_configuration_section, name));
            }

            // save the provided name so we can check for default collection names
            ProvidedName = name;

            if (((options & ConfigurationPropertyOptions.IsDefaultCollection) != 0) && string.IsNullOrEmpty(name))
            {
                name = DefaultCollectionPropertyName;
            }
            else
            {
                ValidatePropertyName(name);
            }

            Name        = name;
            Description = description;
            Type        = type;
            _options    = options;
            Validator   = validator;
            _converter  = converter;

            // Use the default validator if none was supplied
            if (Validator == null)
            {
                Validator = s_defaultValidatorInstance;
            }
            else
            {
                // Make sure the supplied validator supports the type of this property
                if (!Validator.CanValidate(Type))
                {
                    throw new ConfigurationErrorsException(SR.Format(SR.Validator_does_not_support_prop_type, Name));
                }
            }
        }
All Usage Examples Of System.Configuration.ConfigurationValidatorBase::CanValidate
ConfigurationValidatorBase