TypeBuilder.DefineField メソッド

定義

動的な型に新しいフィールドを追加します。

オーバーロード

DefineField(String, Type, FieldAttributes)

指定した名前、属性、フィールド型の新しいフィールドを型に追加します。

DefineField(String, Type, Type[], Type[], FieldAttributes)

指定された名前、属性、フィールドの種類、およびカスタム修飾子を持つ新しいフィールドを型に追加します。

DefineField(String, Type, FieldAttributes)

指定した名前、属性、フィールド型の新しいフィールドを型に追加します。

public:
 System::Reflection::Emit::FieldBuilder ^ DefineField(System::String ^ fieldName, Type ^ type, System::Reflection::FieldAttributes attributes);
public System.Reflection.Emit.FieldBuilder DefineField (string fieldName, Type type, System.Reflection.FieldAttributes attributes);
member this.DefineField : string * Type * System.Reflection.FieldAttributes -> System.Reflection.Emit.FieldBuilder
Public Function DefineField (fieldName As String, type As Type, attributes As FieldAttributes) As FieldBuilder

パラメーター

fieldName
String

フィールドの名前。 fieldName に埋め込み null 値を含めることはできません。

type
Type

フィールドの型。

attributes
FieldAttributes

フィールドの属性。

戻り値

FieldBuilder

定義済みのフィールド。

例外

fieldName の長さが 0 です。

  • または - type が System.Void です。

  • または - このフィールドの親クラスの合計サイズが指定されました。

fieldNamenullです。

型は CreateType() を使用して既に作成されました。

適用対象

DefineField(String, Type, Type[], Type[], FieldAttributes)

指定された名前、属性、フィールドの種類、およびカスタム修飾子を持つ新しいフィールドを型に追加します。

public:
 System::Reflection::Emit::FieldBuilder ^ DefineField(System::String ^ fieldName, Type ^ type, cli::array <Type ^> ^ requiredCustomModifiers, cli::array <Type ^> ^ optionalCustomModifiers, System::Reflection::FieldAttributes attributes);
public System.Reflection.Emit.FieldBuilder DefineField (string fieldName, Type type, Type[]? requiredCustomModifiers, Type[]? optionalCustomModifiers, System.Reflection.FieldAttributes attributes);
public System.Reflection.Emit.FieldBuilder DefineField (string fieldName, Type type, Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, System.Reflection.FieldAttributes attributes);
member this.DefineField : string * Type * Type[] * Type[] * System.Reflection.FieldAttributes -> System.Reflection.Emit.FieldBuilder
Public Function DefineField (fieldName As String, type As Type, requiredCustomModifiers As Type(), optionalCustomModifiers As Type(), attributes As FieldAttributes) As FieldBuilder

パラメーター

fieldName
String

フィールドの名前。 fieldName に埋め込み null 値を含めることはできません。

type
Type

フィールドの型。

requiredCustomModifiers
Type[]

IsConstModifier など、フィールドの必須のカスタム修飾子を表す型の配列。

optionalCustomModifiers
Type[]

IsConstModifier など、フィールドのオプションのカスタム修飾子を表す型の配列。

attributes
FieldAttributes

フィールドの属性。

戻り値

FieldBuilder

定義済みのフィールド。

例外

fieldName の長さが 0 です。

  • または - type が System.Void です。

  • または - このフィールドの親クラスの合計サイズが指定されました。

fieldNamenullです。

型は CreateType() を使用して既に作成されました。

注釈

このオーバーロードは、マネージド コンパイラのデザイナーに提供されます。

適用対象