Example #1
0
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     if (destinationType == (Type)null)
     {
         throw new ArgumentNullException(nameof(destinationType));
     }
     if (value != null && value is SplitterLength)
     {
         SplitterLength length = (SplitterLength)value;
         if (destinationType == typeof(string))
         {
             return((object)SplitterLengthConverter.ToString(length, culture));
         }
         if (destinationType.IsEquivalentTo(typeof(InstanceDescriptor)))
         {
             return((object)new InstanceDescriptor((MemberInfo)typeof(SplitterLength).GetConstructor(new Type[2]
             {
                 typeof(double),
                 typeof(SplitterUnitType)
             }), (ICollection) new object[2]
             {
                 (object)length.Value,
                 (object)length.SplitterUnitType
             }));
         }
     }
     throw this.GetConvertToException(value, destinationType);
 }
Example #2
0
 public override string ToString()
 {
     return(SplitterLengthConverter.ToString(this, CultureInfo.InvariantCulture));
 }