public override object ConvertTo(ITypeDescriptorContext typeDescriptorContext, CultureInfo cultureInfo, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException(nameof(destinationType)); } if (value is FlexLength == false) { throw GetConvertToExceptionInt(value, destinationType); } var flexLength = (FlexLength)value; if (destinationType == typeof(string)) { return(FlexLengthConverter.ToString(flexLength, cultureInfo)); } if (destinationType == typeof(InstanceDescriptor)) { return(new InstanceDescriptor(typeof(FlexLength).GetConstructor(new[] { typeof(double), typeof(FlexLengthUnitType) }), new object[] { flexLength.Value, flexLength.UnitType })); } throw GetConvertToExceptionInt(value, destinationType); }
public override string ToString() { return(FlexLengthConverter.ToString(this, CultureInfo.InvariantCulture)); }