DataTypeAttribute コンストラクター
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
DataTypeAttribute クラスの新しいインスタンスを初期化します。
オーバーロード
| 名前 | 説明 |
|---|---|
| DataTypeAttribute(DataType) |
指定した型名を使用して、 DataTypeAttribute クラスの新しいインスタンスを初期化します。 |
| DataTypeAttribute(String) |
指定したフィールド テンプレート名を使用して、 DataTypeAttribute クラスの新しいインスタンスを初期化します。 |
DataTypeAttribute(DataType)
指定した型名を使用して、 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 クラスの新しいインスタンスを初期化します。
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
データ フィールドに関連付けるユーザー設定フィールド テンプレートの名前。
例外
customDataType が null または空の文字列 ("") です。
注釈
このメソッドは、 UIHintAttribute 属性を使用する代わりに使用できます。