System.Drawing.RectangleConverter.CreateInstance C# (CSharp) Метод

CreateInstance() приватный Метод

private CreateInstance ( ITypeDescriptorContext context, IDictionary propertyValues ) : object
context ITypeDescriptorContext
propertyValues IDictionary
Результат object
        public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)
        {
            if (propertyValues == null)
            {
                throw new ArgumentNullException(nameof(propertyValues));
            }

            object x = propertyValues["X"];
            object y = propertyValues["Y"];
            object width = propertyValues["Width"];
            object height = propertyValues["Height"];

            if (x == null || y == null || width == null || height == null ||
                !(x is int) || !(y is int) || !(width is int) || !(height is int))
            {
                throw new ArgumentException(SR.Format(SR.PropertyValueInvalidEntry));
            }
            return new Rectangle((int)x, (int)y, (int)width, (int)height);
        }