StringValidator.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 與字串相符;否則, 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()))