TimeSpanValidator.CanValidate(Type) 方法
定义
确定是否可以验证该对象的类型。Determines whether the type of the object can be validated.
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
对象的类型。The type of the object.
返回
如果 type 参数与 TimeSpan 值匹配,则为 true;否则为 false。true if the type parameter matches a TimeSpan value; otherwise, false.
示例
下面的代码示例演示如何使用 CanValidate 方法。The following code example demonstrates how to use the CanValidate method. 此代码示例是为类提供的更大示例的一部分 TimeSpanValidator 。This code example is part of a larger example provided for the TimeSpanValidator class.
// Determine if the object to validate can be validated.
Console.WriteLine("CanValidate: {0}",
myTimeSpanValidator.CanValidate(testTimeSpan.GetType()));
' Determine if the object to validate can be validated.
Console.WriteLine("CanValidate: {0}", _
myTimeSpanValidator.CanValidate(testTimeSpan.GetType()))