VirtualTypeBuilder::AttributeCollection::Add Method (Attribute^)
Visual Studio 2015
Adds an Attribute to the end of the VirtualTypeBuilder::AttributeCollection.
Assembly: Microsoft.VisualStudio.Shell.Design (in Microsoft.VisualStudio.Shell.Design.dll)
Parameters
- value
-
Type:
System::Attribute^
The Attribute to be added to the end of the collection.
| Exception | Condition |
|---|---|
| ArgumentException | value cannot be placed on a class. |
| ArgumentNullException | The attribute is null. |
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.
Show: