QueryStringConverter.CanConvert(Type) Méthode

Définition

Détermine si le type spécifié peut être converti vers et depuis une représentation sous forme de chaîne.

public:
 virtual bool CanConvert(Type ^ type);
public virtual bool CanConvert (Type type);
abstract member CanConvert : Type -> bool
override this.CanConvert : Type -> bool
Public Overridable Function CanConvert (type As Type) As Boolean

Paramètres

type
Type

Type à convertir.

Retours

Valeur qui spécifie si le type peut être converti.

Exemples

Le code suivant indique comment déterminer si QueryStringConverter peut convertir vers et à partir d'un type précisé.

if (converter.CanConvert(typeof(Int32)))
    converter.ConvertStringToValue("123", typeof(Int32));
If (converter.CanConvert(GetType(Int32))) Then
    converter.ConvertStringToValue("123", GetType(Int32))
End If

S’applique à