StringValidator.CanValidate(Type) 方法

定义

确定是否可以基于类型验证对象。

public:
 override bool CanValidate(Type ^ type);
public override bool CanValidate(Type type);
override this.CanValidate : Type -> bool
Public Overrides Function CanValidate (type As Type) As Boolean

参数

type
Type

对象类型。

返回

true 如果参数与字符串匹配,则为 type ;否则为 false

示例

以下示例演示如何使用 CanValidate 该方法。 该代码示例是 StringValidator 类中的一个较大示例的一部分。

// Determine if the object to validate can be validated.
Console.WriteLine("CanValidate: {0}",
  myStrValidator.CanValidate(testVal.GetType()));
' Determine if the object to validate can be validated.
Console.WriteLine("CanValidate: {0}", _
  myStrValidator.CanValidate(testVal.GetType()))

适用于