VirtualTypeBuilder.AttributeCollection.Add Method

Adds an Attribute to the end of the VirtualTypeBuilder.AttributeCollection.

Namespace:  Microsoft.VisualStudio.Shell.Design
Assembly:  Microsoft.VisualStudio.Shell.Design (in Microsoft.VisualStudio.Shell.Design.dll)

Syntax

‘선언
Public Function Add ( _
    value As Attribute _
) As Integer
‘사용 방법
Dim instance As VirtualTypeBuilder..::..AttributeCollection
Dim value As Attribute
Dim returnValue As Integer

returnValue = instance.Add(value)
public int Add(
    Attribute value
)
public:
int Add(
    Attribute^ value
)
member Add : 
        value:Attribute -> int 
public function Add(
    value : Attribute
) : int

Parameters

Return Value

Type: System.Int32
The index at which the value has been added.

Exceptions

Exception Condition
ArgumentException

value cannot be placed on a class.

ArgumentNullException

The attribute is nulla null reference (Nothing in Visual Basic).

Remarks

Attributes are added in the order you would expect them to be declared on the class. The following code example shows how to add attributes that would be declared on a physical class.

[Browsable(true)]
[Description(“Hello world”)]
public class MyClass {}

The following code example shows the order in which to add attributes.

Add(new DescriptionAttribute(“Hello world”));
Add(BrowsableAttribute.Yes);

Attributes that are marked as “allow multiple” will be added multiple times, while those not marked with "allow multiple" will only be added once, with the last one added taking precedence. This is in the same manner as a compiler.

.NET Framework Security

See Also

Reference

VirtualTypeBuilder.AttributeCollection Class

VirtualTypeBuilder.AttributeCollection Members

Microsoft.VisualStudio.Shell.Design Namespace

System.Collections.CollectionBase