Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Adds an EventInfo to the end of the collection.
Namespace:  Microsoft.VisualStudio.Shell.Design
Assembly:  Microsoft.VisualStudio.Shell.Design (in Microsoft.VisualStudio.Shell.Design.dll)
Syntax
'Declaration
Public Function Add ( _
    name As String, _
    handlerType As Type, _
    attributes As Attribute(), _
    methodAttributes As MethodAttributes _
) As Integer
public int Add(
    string name,
    Type handlerType,
    Attribute[] attributes,
    MethodAttributes methodAttributes
)
public:
int Add(
    String^ name, 
    Type^ handlerType, 
    array<Attribute^>^ attributes, 
    MethodAttributes methodAttributes
)
member Add : 
        name:string * 
        handlerType:Type * 
        attributes:Attribute[] * 
        methodAttributes:MethodAttributes -> int
public function Add(
    name : String, 
    handlerType : Type, 
    attributes : Attribute[], 
    methodAttributes : MethodAttributes
) : int
Parameters
- name 
 Type: String- The name of the event to add. 
- handlerType 
 Type: Type- The type of delegate this event represents. 
- attributes 
 Type: array<Attribute[]- An array of Attribute objects. 
- methodAttributes 
 Type: MethodAttributes- The only method attributes currently supported are Public and/or Static. 
Return Value
Type: Int32
The index at which the value has been added.
Exceptions
| Exception | Condition | 
|---|---|
| ArgumentNullException | name or handlerType or an element in attributes is nulla null reference (Nothing in Visual Basic). attributes itself may be nulla null reference (Nothing in Visual Basic). | 
| ArgumentException | handlerType is not a run-time type -or- methodAttributes 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 events. | 
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.