DataTypeAttribute Constructeurs
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Initialise une nouvelle instance de la classe DataTypeAttribute.
Surcharges
| Nom | Description |
|---|---|
| DataTypeAttribute(DataType) |
Initialise une nouvelle instance de la DataTypeAttribute classe à l’aide du nom de type spécifié. |
| DataTypeAttribute(String) |
Initialise une nouvelle instance de la DataTypeAttribute classe à l’aide du nom de modèle de champ spécifié. |
DataTypeAttribute(DataType)
- Source:
- DataTypeAttribute.cs
- Source:
- DataTypeAttribute.cs
- Source:
- DataTypeAttribute.cs
- Source:
- DataTypeAttribute.cs
- Source:
- DataTypeAttribute.cs
Initialise une nouvelle instance de la DataTypeAttribute classe à l’aide du nom de type spécifié.
public:
DataTypeAttribute(System::ComponentModel::DataAnnotations::DataType dataType);
public DataTypeAttribute(System.ComponentModel.DataAnnotations.DataType dataType);
new System.ComponentModel.DataAnnotations.DataTypeAttribute : System.ComponentModel.DataAnnotations.DataType -> System.ComponentModel.DataAnnotations.DataTypeAttribute
Public Sub New (dataType As DataType)
Paramètres
- dataType
- DataType
Nom du type à associer au champ de données.
Exemples
L’exemple suivant montre comment utiliser le DataTypeAttribute(DataType) constructeur pour spécifier un autre type pour un champ de données.
// Add type information.
[DataType(DataType.EmailAddress)]
public object EmailAddress;
' Add type information.
<DataType(DataType.EmailAddress)> _
Public EmailAddress As Object
Remarques
Le nom est l’une des valeurs définies par l’énumération System.ComponentModel.DataAnnotations.DataType .
S’applique à
DataTypeAttribute(String)
- Source:
- DataTypeAttribute.cs
- Source:
- DataTypeAttribute.cs
- Source:
- DataTypeAttribute.cs
- Source:
- DataTypeAttribute.cs
- Source:
- DataTypeAttribute.cs
Initialise une nouvelle instance de la DataTypeAttribute classe à l’aide du nom de modèle de champ spécifié.
public:
DataTypeAttribute(System::String ^ customDataType);
public DataTypeAttribute(string customDataType);
new System.ComponentModel.DataAnnotations.DataTypeAttribute : string -> System.ComponentModel.DataAnnotations.DataTypeAttribute
Public Sub New (customDataType As String)
Paramètres
- customDataType
- String
Nom du modèle de champ personnalisé à associer au champ de données.
Exceptions
customDataType est null ou une chaîne vide (« »).
Remarques
Cette méthode offre une alternative à l’utilisation de l’attribut UIHintAttribute .