DataTypeAttribute Konstruktorok

Definíció

Inicializálja a DataTypeAttribute osztály új példányát.

Túlterhelések

Name Description
DataTypeAttribute(DataType)

Inicializálja az DataTypeAttribute osztály új példányát a megadott típusnév használatával.

DataTypeAttribute(String)

Inicializálja az DataTypeAttribute osztály új példányát a megadott mezősablonnév használatával.

DataTypeAttribute(DataType)

Forrás:
DataTypeAttribute.cs
Forrás:
DataTypeAttribute.cs
Forrás:
DataTypeAttribute.cs
Forrás:
DataTypeAttribute.cs
Forrás:
DataTypeAttribute.cs

Inicializálja az DataTypeAttribute osztály új példányát a megadott típusnév használatával.

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éterek

dataType
DataType

Az adatmezőhöz társítandó típus neve.

Példák

Az alábbi példa bemutatja, hogyan adhat meg alternatív típust egy adatmezőhöz a DataTypeAttribute(DataType) konstruktor használatával.

// Add type information.
[DataType(DataType.EmailAddress)]
public object EmailAddress;
' Add type information.
<DataType(DataType.EmailAddress)> _
Public EmailAddress As Object

Megjegyzések

A név az enumerálás által System.ComponentModel.DataAnnotations.DataType definiált értékek egyike.

A következőre érvényes:

DataTypeAttribute(String)

Forrás:
DataTypeAttribute.cs
Forrás:
DataTypeAttribute.cs
Forrás:
DataTypeAttribute.cs
Forrás:
DataTypeAttribute.cs
Forrás:
DataTypeAttribute.cs

Inicializálja az DataTypeAttribute osztály új példányát a megadott mezősablonnév használatával.

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éterek

customDataType
String

Az adatmezőhöz társítandó egyéni mezősablon neve.

Kivételek

customDataType üres null sztring ("").

Megjegyzések

Ez a módszer alternatívát kínál az UIHintAttribute attribútum használatára.

A következőre érvényes: