DataTypeAttribute コンストラクター

定義

DataTypeAttribute クラスの新しいインスタンスを初期化します。

オーバーロード

DataTypeAttribute(DataType)

指定した型名を使用して、DataTypeAttribute クラスの新しいインスタンスを初期化します。

DataTypeAttribute(String)

指定されたフィールド テンプレート名を使用して、DataTypeAttribute クラスの新しいインスタンスを初期化します。

DataTypeAttribute(DataType)

ソース:
DataTypeAttribute.cs
ソース:
DataTypeAttribute.cs
ソース:
DataTypeAttribute.cs

指定した型名を使用して、DataTypeAttribute クラスの新しいインスタンスを初期化します。

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)

パラメーター

dataType
DataType

データ フィールドに関連付ける型の名前。

次の例は、コンストラクターを DataTypeAttribute(DataType) 使用してデータ フィールドの代替型を指定する方法を示しています。

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

注釈

名前は、列挙体によって定義される値の System.ComponentModel.DataAnnotations.DataType 1 つです。

適用対象

DataTypeAttribute(String)

ソース:
DataTypeAttribute.cs
ソース:
DataTypeAttribute.cs
ソース:
DataTypeAttribute.cs

指定されたフィールド テンプレート名を使用して、DataTypeAttribute クラスの新しいインスタンスを初期化します。

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)

パラメーター

customDataType
String

データ フィールドに関連付けるカスタム フィールド テンプレートの名前。

例外

customDataTypenull または空の文字列 ("") です。

注釈

このメソッドは、 属性を使用する代わりに使用 UIHintAttribute できます。

適用対象