TypeBuilder.DefineField Méthode

Définition

Ajoute un nouveau champ au type dynamique.

Surcharges

Nom Description
DefineField(String, Type, FieldAttributes)

Ajoute un nouveau champ au type, avec le nom, les attributs et le type de champ donnés.

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

Ajoute un nouveau champ au type, avec le nom, les attributs, le type de champ et les modificateurs personnalisés donnés.

DefineField(String, Type, FieldAttributes)

Ajoute un nouveau champ au type, avec le nom, les attributs et le type de champ donnés.

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

Paramètres

fieldName
String

Nom du champ. fieldName ne peut pas contenir de valeurs Null incorporées.

type
Type

Type du champ.

attributes
FieldAttributes

Attributs du champ.

Retours

Champ défini.

Exceptions

La longueur est égale fieldName à zéro.

-ou-

type est System.Void.

-ou-

Une taille totale a été spécifiée pour la classe parente de ce champ.

fieldName a la valeur null.

Le type a été créé précédemment à l’aide CreateType()de .

S’applique à

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

Ajoute un nouveau champ au type, avec le nom, les attributs, le type de champ et les modificateurs personnalisés donnés.

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);
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

Paramètres

fieldName
String

Nom du champ. fieldName ne peut pas contenir de valeurs Null incorporées.

type
Type

Type du champ.

requiredCustomModifiers
Type[]

Tableau de types représentant les modificateurs personnalisés requis pour le champ, par IsConstModifierexemple .

optionalCustomModifiers
Type[]

Tableau de types représentant les modificateurs personnalisés facultatifs pour le champ, tels que IsConstModifier.

attributes
FieldAttributes

Attributs du champ.

Retours

Champ défini.

Exceptions

La longueur est égale fieldName à zéro.

-ou-

type est System.Void.

-ou-

Une taille totale a été spécifiée pour la classe parente de ce champ.

fieldName a la valeur null.

Le type a été créé précédemment à l’aide CreateType()de .

Remarques

Cette surcharge est fournie pour les concepteurs de compilateurs managés.

S’applique à