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

物件類型。

傳回

如果 type 參數符合某字串,則為 true,否則為 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()))

適用於