VirtualTypeBuilder.FieldInfoCollection.Add 方法

定义

重载

Add(FieldInfo)

FieldInfo 添加到集合的末尾。

Add(String, Type)

FieldInfo 添加到集合的末尾。

Add(String, Type, Attribute[])

FieldInfo 添加到集合的末尾。

Add(String, Type, Attribute[], FieldAttributes)

FieldInfo 添加到集合的末尾。

Add(FieldInfo)

FieldInfo 添加到集合的末尾。

public:
 int Add(System::Reflection::FieldInfo ^ value);
public int Add (System.Reflection.FieldInfo value);
member this.Add : System.Reflection.FieldInfo -> int
Public Function Add (value As FieldInfo) As Integer

参数

value
FieldInfo

要添加到集合末尾的 FieldInfo

返回

Int32

已添加值处的索引。

适用于

Add(String, Type)

FieldInfo 添加到集合的末尾。

public:
 int Add(System::String ^ name, Type ^ fieldType);
public:
 int Add(Platform::String ^ name, Platform::Type ^ fieldType);
public int Add (string name, Type fieldType);
member this.Add : string * Type -> int
Public Function Add (name As String, fieldType As Type) As Integer

参数

name
String

要添加的字段的名称。

fieldType
Type

字段的类型。

返回

Int32

已添加值处的索引。

例外

namefieldTypenull

fieldType 不是运行时类型。

适用于

Add(String, Type, Attribute[])

FieldInfo 添加到集合的末尾。

public:
 int Add(System::String ^ name, Type ^ fieldType, cli::array <Attribute ^> ^ attributes);
public:
 int Add(Platform::String ^ name, Platform::Type ^ fieldType, Platform::Array <Platform::Metadata::Attribute ^> ^ attributes);
public int Add (string name, Type fieldType, Attribute[] attributes);
member this.Add : string * Type * Attribute[] -> int
Public Function Add (name As String, fieldType As Type, attributes As Attribute()) As Integer

参数

name
String

要添加的字段的名称。

fieldType
Type

字段的类型。

attributes
Attribute[]

一个特性数组,这些特性必须为 Public 和/或 Static

返回

Int32

已添加值处的索引。

例外

namefieldType 中的元素 attributesnullattributes 本身可能是 null

fieldType 不是运行时类型。

适用于

Add(String, Type, Attribute[], FieldAttributes)

FieldInfo 添加到集合的末尾。

public:
 int Add(System::String ^ name, Type ^ fieldType, cli::array <Attribute ^> ^ attributes, System::Reflection::FieldAttributes fieldAttributes);
public int Add (string name, Type fieldType, Attribute[] attributes, System.Reflection.FieldAttributes fieldAttributes);
member this.Add : string * Type * Attribute[] * System.Reflection.FieldAttributes -> int
Public Function Add (name As String, fieldType As Type, attributes As Attribute(), fieldAttributes As FieldAttributes) As Integer

参数

name
String

要添加的字段的名称。

fieldType
Type

字段的类型。

attributes
Attribute[]

此参数用于对类成员进行相应的配置。 Add(String, Type, Attribute[], FieldAttributes) 仅接受适用于或类别的的值 MemberAttributes AccessMask ScopeMask

fieldAttributes
FieldAttributes

此参数为此成员指定其他字段属性。 默认字段特性为 Public 。 当前支持的字段属性为 PublicStatic

返回

Int32

已添加值处的索引。

例外

namefieldType 中的元素 attributesnullattributes 本身可能是 null

fieldType 不是运行时类型-或-不 fieldAttributes 包含 Public 或包含除和以外的设置位 Public Static ,也不能将通过参数传入的特性 attributes 应用于字段。

适用于