System.Drawing.SizeFConverter.CreateInstance C# (CSharp) Method

CreateInstance() private method

private CreateInstance ( ITypeDescriptorContext context, IDictionary propertyValues ) : object
context ITypeDescriptorContext
propertyValues IDictionary
return object
        public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)
        {
            if (propertyValues == null)
            {
                throw new ArgumentNullException(nameof(propertyValues));
            }


            object width = propertyValues["Width"];
            object height = propertyValues["Height"];

            if (width == null || height == null ||
                !(width is float) || !(height is float))
            {
                throw new ArgumentException(SR.Format(SR.PropertyValueInvalidEntry));
            }
            return new SizeF((float)width, (float)height);
        }