ToolboxItem.ValidatePropertyType(String, Object, Type, Boolean) 方法

定义

验证对象是否为给定类型。

protected:
 void ValidatePropertyType(System::String ^ propertyName, System::Object ^ value, Type ^ expectedType, bool allowNull);
protected void ValidatePropertyType(string propertyName, object value, Type expectedType, bool allowNull);
protected void ValidatePropertyType(string propertyName, object? value, Type expectedType, bool allowNull);
member this.ValidatePropertyType : string * obj * Type * bool -> unit
Protected Sub ValidatePropertyType (propertyName As String, value As Object, expectedType As Type, allowNull As Boolean)

参数

propertyName
String

要验证的属性的名称。

value
Object

要对其验证的可选值。

expectedType
Type

属性的预期类型。

allowNull
Boolean

true 如果为 allow,则为 null;否则为 false.

例外

value nullallowNullfalse

value 不是由 expectedType. 指定的类型。

注解

该方法 ValidatePropertyType 作为方法的 ValidatePropertyValue 帮助程序方法调用。

适用于