PositiveTimeSpanValidator.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 パラメーターがTimeSpan オブジェクトと一致する場合は a0/>。それ以外の場合はfalse

次のコード例は、 CanValidate メソッドの使用方法を示しています。 このコード例は、 PositiveTimeSpanValidator クラスに提供されるより大きな例の一部です。

// Determine if the Validator can validate
// the type it contains.
valBase = customValAttr.ValidatorInstance;
if (valBase.CanValidate(resultTimeSpan.GetType()))
{
    // Validate the TimeSpan using a
    // custom PositiveTimeSpanValidator.
    valBase.Validate(resultTimeSpan);
}
' Determine if the Validator can validate
' the type it contains.
valBase = customValAttr.ValidatorInstance
If valBase.CanValidate(resultTimeSpan.GetType()) Then
    ' Validate the TimeSpan using a
    ' custom PositiveTimeSpanValidator.
    valBase.Validate(resultTimeSpan)
End If

適用対象