TypeBuilder.DefineField Método

Definición

Agrega un nuevo campo al tipo dinámico.

Sobrecargas

Nombre Description
DefineField(String, Type, FieldAttributes)

Agrega un nuevo campo al tipo, con el nombre, los atributos y el tipo de campo especificados.

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

Agrega un nuevo campo al tipo, con el nombre, los atributos, el tipo de campo y los modificadores personalizados especificados.

DefineField(String, Type, FieldAttributes)

Source:
TypeBuilder.cs
Source:
TypeBuilder.cs
Source:
TypeBuilder.cs
Source:
TypeBuilder.cs
Source:
TypeBuilder.cs

Agrega un nuevo campo al tipo, con el nombre, los atributos y el tipo de campo especificados.

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

Parámetros

fieldName
String

Nombre del campo. fieldName no puede contener valores NULL incrustados.

type
Type

Tipo del campo.

attributes
FieldAttributes

Atributos del campo.

Devoluciones

Campo definido.

Excepciones

La longitud de fieldName es cero.

O bien

type es System.Void.

O bien

Se especificó un tamaño total para la clase primaria de este campo.

fieldName es null.

El tipo se creó anteriormente mediante CreateType().

Se aplica a

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

Source:
TypeBuilder.cs
Source:
TypeBuilder.cs
Source:
TypeBuilder.cs
Source:
TypeBuilder.cs
Source:
TypeBuilder.cs

Agrega un nuevo campo al tipo, con el nombre, los atributos, el tipo de campo y los modificadores personalizados especificados.

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

Parámetros

fieldName
String

Nombre del campo. fieldName no puede contener valores NULL incrustados.

type
Type

Tipo del campo.

requiredCustomModifiers
Type[]

Matriz de tipos que representa los modificadores personalizados necesarios para el campo, como IsConstModifier.

optionalCustomModifiers
Type[]

Matriz de tipos que representa los modificadores personalizados opcionales para el campo, como IsConstModifier.

attributes
FieldAttributes

Atributos del campo.

Devoluciones

Campo definido.

Excepciones

La longitud de fieldName es cero.

O bien

type es System.Void.

O bien

Se especificó un tamaño total para la clase primaria de este campo.

fieldName es null.

El tipo se creó anteriormente mediante CreateType().

Comentarios

Esta sobrecarga se proporciona para diseñadores de compiladores administrados.

Se aplica a