TypeBuilder.DefineFieldCore 方法

定义

在派生类中重写时,将具有给定名称、属性、字段类型和自定义修饰符的新字段添加到类型。

protected:
 abstract System::Reflection::Emit::FieldBuilder ^ DefineFieldCore(System::String ^ fieldName, Type ^ type, cli::array <Type ^> ^ requiredCustomModifiers, cli::array <Type ^> ^ optionalCustomModifiers, System::Reflection::FieldAttributes attributes);
protected abstract System.Reflection.Emit.FieldBuilder DefineFieldCore (string fieldName, Type type, Type[]? requiredCustomModifiers, Type[]? optionalCustomModifiers, System.Reflection.FieldAttributes attributes);
abstract member DefineFieldCore : string * Type * Type[] * Type[] * System.Reflection.FieldAttributes -> System.Reflection.Emit.FieldBuilder
Protected MustOverride Function DefineFieldCore (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[]

表示字段所需的自定义修饰符的类型数组。

optionalCustomModifiers
Type[]

表示字段的可选自定义修饰符的类型数组。

attributes
FieldAttributes

枚举值的按位组合,指定字段的属性。

返回

已定义的字段。

适用于