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 x = propertyValues["X"];
object y = propertyValues["Y"];
if (x == null || y == null ||
!(x is int) || !(y is int))
{
throw new ArgumentException(SR.Format(SR.PropertyValueInvalidEntry));
}
return new Point((int)x, (int)y);
}