public override object ConvertTo(ITypeDescriptorContext typeDescriptorContext, CultureInfo cultureInfo, object value, Type destinationType)
        {
            // Convert the length to a String
            if (value is double)
            {
                double length = (double)value;
                if (destinationType == typeof(string))
                {
                    return(length.IsNaN() ?
                           "Auto" :
                           Convert.ToString(length, cultureInfo));
                }
            }

            return(TypeConverters.ConvertTo(this, value, destinationType));
        }
Beispiel #2
0
        public override object ConvertTo(ITypeDescriptorContext typeDescriptorContext, CultureInfo cultureInfo, object value, Type destinationType)
        {
            object result;

            if (value is double)
            {
                var num = (double)value;
                if (destinationType == typeof(string))
                {
                    result = (num.IsNaN() ? "Auto" : Convert.ToString(num, cultureInfo));
                    return(result);
                }
            }
            result = TypeConverters.ConvertTo(this, value, destinationType);
            return(result);
        }