VirtualTypeBuilder::FieldInfoCollection::Add Method (String^, Type^, array<Attribute^>^, FieldAttributes)
Adds a FieldInfo to the end of the collection.
Assembly: Microsoft.VisualStudio.Shell.Design (in Microsoft.VisualStudio.Shell.Design.dll)
public: int Add( String^ name, Type^ fieldType, array<Attribute^>^ attributes, FieldAttributes fieldAttributes )
Parameters
- name
-
Type:
System::String^
The name of the field to add.
- fieldType
-
Type:
System::Type^
The type of field.
- attributes
-
Type:
array<System::Attribute^>^
This parameter is used to configure the class member appropriately. Add only accepts the values of MemberAttributes that fit into the AccessMask or ScopeMask categories.
- fieldAttributes
-
Type:
System.Reflection::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.
| Exception | Condition |
|---|---|
| ArgumentNullException | name or fieldType or an element in attributes is null. attributes itself may be null. |
| ArgumentException | 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. |