示例#1
0
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     if ((destinationType != null) && (value is Vector3DCollection))
     {
         Vector3DCollection vectords = (Vector3DCollection)value;
         if (destinationType == typeof(InstanceDescriptor))
         {
             ConstructorInfo ci = typeof(Vector3DCollection).GetConstructor(new Type[] { typeof(Vector3D[]) });
             return(new InstanceDescriptor(ci, new object[] { vectords.ToArray() }));
         }
         else if (destinationType == typeof(string))
         {
             return(vectords.ConvertToString(null, culture));
         }
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }