RegexStringValidator.CanValidate(Type) Method

Definition

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

Parameters

type
Type

The type of object.

Returns

true if the type parameter matches a string; otherwise, false.

Examples

The following example demonstrates how to use the CanValidate method. This code example is part of a larger example that is provided for the RegexStringValidator class.

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

Remarks

An exception is thrown if the validation fails.

Applies to