TypeBuilder.DefineField Metoda

Definicja

Dodaje nowe pole do typu dynamicznego.

Przeciążenia

DefineField(String, Type, FieldAttributes)

Dodaje nowe pole do typu z daną nazwą, atrybutami i typem pola.

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

Dodaje nowe pole do typu z daną nazwą, atrybutami, typem pola i modyfikatorami niestandardowymi.

DefineField(String, Type, FieldAttributes)

Źródło:
TypeBuilder.cs
Źródło:
TypeBuilder.cs
Źródło:
TypeBuilder.cs

Dodaje nowe pole do typu z daną nazwą, atrybutami i typem pola.

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

Parametry

fieldName
String

Nazwa pola. fieldName nie może zawierać osadzonych wartości null.

type
Type

Typ pola.

attributes
FieldAttributes

Atrybuty pola.

Zwraca

Zdefiniowane pole.

Wyjątki

Długość fieldName to zero.

-lub-

type is System.Void.

-lub-

Określono całkowity rozmiar dla klasy nadrzędnej tego pola.

fieldName to null.

Typ został wcześniej utworzony przy użyciu polecenia CreateType().

Dotyczy

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

Źródło:
TypeBuilder.cs
Źródło:
TypeBuilder.cs
Źródło:
TypeBuilder.cs

Dodaje nowe pole do typu z daną nazwą, atrybutami, typem pola i modyfikatorami niestandardowymi.

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

Parametry

fieldName
String

Nazwa pola. fieldName nie może zawierać osadzonych wartości null.

type
Type

Typ pola.

requiredCustomModifiers
Type[]

Tablica typów reprezentujących wymagane modyfikatory niestandardowe dla pola, takie jak IsConstModifier.

optionalCustomModifiers
Type[]

Tablica typów reprezentujących opcjonalne modyfikatory niestandardowe dla pola, takie jak IsConstModifier.

attributes
FieldAttributes

Atrybuty pola.

Zwraca

Zdefiniowane pole.

Wyjątki

Długość fieldName to zero.

-lub-

type is System.Void.

-lub-

Określono całkowity rozmiar dla klasy nadrzędnej tego pola.

fieldName to null.

Typ został wcześniej utworzony przy użyciu polecenia CreateType().

Uwagi

To przeciążenie jest udostępniane projektantom zarządzanych kompilatorów.

Dotyczy