Share via


VirtualTypeBuilder.FieldInfoCollection.Add Method

Definition

Overloads

Add(FieldInfo)

Adds a FieldInfo to the end of the collection.

Add(String, Type)

Adds a FieldInfo to the end of the collection.

Add(String, Type, Attribute[])

Adds a FieldInfo to the end of the collection.

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

Adds a FieldInfo to the end of the collection.

Add(FieldInfo)

Adds a FieldInfo to the end of the collection.

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

Parameters

value
FieldInfo

The FieldInfo to be added to the end of the collection.

Returns

The index at which the value has been added.

Applies to

Add(String, Type)

Adds a FieldInfo to the end of the collection.

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

Parameters

name
String

The name of the field to add.

fieldType
Type

The type of field.

Returns

The index at which the value has been added.

Exceptions

name or fieldType is null.

fieldType is not a run-time type.

Applies to

Add(String, Type, Attribute[])

Adds a FieldInfo to the end of the collection.

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

Parameters

name
String

The name of the field to add.

fieldType
Type

The type of field.

attributes
Attribute[]

An array of attributes that must be Public and/or Static.

Returns

The index at which the value has been added.

Exceptions

name or fieldType or an element in attributes is null. attributes itself may be null.

fieldType is not a run-time type.

Applies to

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

Adds a FieldInfo to the end of the collection.

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

Parameters

name
String

The name of the field to add.

fieldType
Type

The type of field.

attributes
Attribute[]

This parameter is used to configure the class member appropriately. Add(String, Type, Attribute[], FieldAttributes) only accepts the values of MemberAttributes that fit into the AccessMask or ScopeMask categories.

fieldAttributes
FieldAttributes

This parameter specifies additional field attributes for this member. The default field attribute is Public. The only field attributes currently supported are Public and Static.

Returns

The index at which the value has been added.

Exceptions

name or fieldType or an element in attributes is null. attributes itself may be null.

fieldType is not a run-time type-or- fieldAttributes does not contain Public or contains set bits other than Public and Static, or attributes passed in through the attributes parameter cannot be applied to fields.

Applies to