System.Configuration.ConfigurationProperty.Validate C# (CSharp) Метод

Validate() приватный Метод

private Validate ( object value ) : void
value object
Результат void
        internal void Validate(object value) {
            try {
                _validator.Validate(value);
            }
            catch (Exception ex) {
                throw new ConfigurationErrorsException(SR.GetString(SR.Top_level_validation_error, _name, ex.Message),ex);
            }
            catch {
                throw new ConfigurationErrorsException(SR.GetString(SR.Top_level_validation_error, _name, ExceptionUtil.NoExceptionInformation));
            }
        }
        private void CreateConverter() {

Usage Example

Пример #1
0
        protected void SetPropertyValue(ConfigurationProperty prop, object value, bool ignoreLocks)
        {
            try
            {
                if (value != null)
                {
                    /* XXX all i know for certain is that Validation happens here */
                    prop.Validate(value);

                    /* XXX presumably the actual setting of the
                     * property happens here instead of in the
                     * set_Item code below, but that would mean
                     * the Value needs to be stuffed in the
                     * property, not the propertyinfo (or else the
                     * property needs a ref to the property info
                     * to correctly set the value). */
                }
            }
            catch (Exception e)
            {
                throw new ConfigurationErrorsException(
                          string.Format("The value for the property '{0}' on type {1} is not valid.", prop.Name,
                                        ElementInformation.Type), e);
            }
        }
All Usage Examples Of System.Configuration.ConfigurationProperty::Validate