/// <summary> /// Converts the value into a string. /// </summary> public override string ConvertToString(object value, IValueSerializerContext context) { if (value is Vector3DCollection) { Vector3DCollection instance = (Vector3DCollection)value; #pragma warning suppress 6506 // instance is obviously not null return(instance.ConvertToString(null, System.Windows.Markup.TypeConverterHelper.InvariantEnglishUS)); } return(base.ConvertToString(value, context)); }
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)); }