/// <summary>
        /// Converts the value into a string.
        /// </summary>
        public override string ConvertToString(object value, IValueSerializerContext context)
        {
            if (value is Int32Collection)
            {
                Int32Collection instance = (Int32Collection)value;


                #pragma warning suppress 6506 // instance is obviously not null
                return(instance.ConvertToString(null, System.Windows.Markup.TypeConverterHelper.InvariantEnglishUS));
            }

            return(base.ConvertToString(value, context));
        }
Exemplo n.º 2
0
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     if ((destinationType != null) && (value is Int32Collection))
     {
         Int32Collection ints = (Int32Collection)value;
         if (destinationType == typeof(InstanceDescriptor))
         {
             ConstructorInfo ci = typeof(Int32Collection).GetConstructor(new Type[] { typeof(int[]) });
             return(new InstanceDescriptor(ci, new object[] { ints.ToArray() }));
         }
         else if (destinationType == typeof(string))
         {
             return(ints.ConvertToString(null, culture));
         }
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }