示例#1
0
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     if (destinationType == null)
     {
         throw new ArgumentNullException("destinationType");
     }
     if (value != null && value is DataGridLength)
     {
         DataGridLength length = (DataGridLength)value;
         if (destinationType == typeof(string))
         {
             return(DataGridLengthConverter.ConvertToString(length, culture));
         }
         if (destinationType == typeof(InstanceDescriptor))
         {
             ConstructorInfo constructor = typeof(DataGridLength).GetConstructor(new Type[]
             {
                 typeof(double),
                 typeof(DataGridLengthUnitType)
             });
             return(new InstanceDescriptor(constructor, new object[]
             {
                 length.Value,
                 length.UnitType
             }));
         }
     }
     throw base.GetConvertToException(value, destinationType);
 }
 /// <summary>Returns a string that represents the current object.</summary>
 /// <returns>A string that represent the current object.</returns>
 // Token: 0x06004916 RID: 18710 RVA: 0x0014B5F9 File Offset: 0x001497F9
 public override string ToString()
 {
     return(DataGridLengthConverter.ConvertToString(this, CultureInfo.InvariantCulture));
 }