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 則為 null,否則為 false

例外狀況

valuenull,而 allowNullfalse

value 不是 expectedType 所指定的型別。

備註

方法 ValidatePropertyType 會呼叫為 方法的 ValidatePropertyValue 協助程式方法。

適用於