Accord.Controls.RangeTypeConverter.CreateInstance C# (CSharp) Метод

CreateInstance() публичный Метод

Creates an instance of the type that this T:System.ComponentModel.TypeConverter is associated with, using the specified context, given a set of property values for the object.
public CreateInstance ( ITypeDescriptorContext context, IDictionary propertyValues ) : object
context ITypeDescriptorContext An that provides a format context.
propertyValues IDictionary An of new property values.
Результат object
        public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)
        {
            if (propertyValues != null)
            {
                if (context.PropertyDescriptor.PropertyType == typeof(DoubleRange))
                {
                    double max = (double)propertyValues["Max"];
                    double min = (double)propertyValues["Min"];

                    return new DoubleRange(min, max);
                }
                else if (context.PropertyDescriptor.PropertyType == typeof(IntRange))
                {
                    int max = (int)propertyValues["Max"];
                    int min = (int)propertyValues["Min"];

                    return new IntRange(min, max);
                }
            }


            return base.CreateInstance(context, propertyValues);
        }