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

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

private ConvertToString ( Object value ) : string
value Object
Результат string
        internal string ConvertToString(Object value) {
            string result = null;

            try {
                if (_type == typeof(bool)) {
                    result = ((bool)value) ? "true" : "false"; // the converter will break 1.1 compat for bool
                }
                else {
                    result = Converter.ConvertToInvariantString(value);
                }
            }
            catch (Exception ex) {
                throw new ConfigurationErrorsException(SR.GetString(SR.Top_level_conversion_error_to_string, _name, ex.Message));
            }
            catch {
                throw new ConfigurationErrorsException(SR.GetString(SR.Top_level_conversion_error_to_string, _name, ExceptionUtil.NoExceptionInformation));
            }

            return result;
        }
        internal void Validate(object value) {

Usage Example

Пример #1
0
 internal string GetStringValue()
 {
     return(property.ConvertToString(Value));
 }