PositiveTimeSpanValidator.CanValidate(Type) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
개체 형식의 유효성을 검사할 수 있는지 여부를 결정합니다.
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 고, 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