ToolboxItem.ValidatePropertyType Method (String, Object, Type, Boolean)

 

Validates that an object is of a given type.

Namespace:   System.Drawing.Design
Assembly:  System.Drawing (in System.Drawing.dll)

protected void ValidatePropertyType(
	string propertyName,
	object value,
	Type expectedType,
	bool allowNull
)

Parameters

propertyName
Type: System.String

The name of the property to validate.

value
Type: System.Object

Optional value against which to validate.

expectedType
Type: System.Type

The expected type of the property.

allowNull
Type: System.Boolean

true to allow null; otherwise, false.

Exception Condition
ArgumentNullException

value is null, and allowNull is false.

ArgumentException

value is not the type specified by expectedType.

The ValidatePropertyType method is called as a helper method to the ValidatePropertyValue method.

.NET Framework
Available since 2.0
Return to top
Show: