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()))

適用於