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 a MethodInfo 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, _
    returnType As Type, _
    parameterTypes As Type(), _
    attributes As Attribute(), _
    methodAttributes As MethodAttributes _
) As Integer
public int Add(
    string name,
    Type returnType,
    Type[] parameterTypes,
    Attribute[] attributes,
    MethodAttributes methodAttributes
)
public:
int Add(
    String^ name, 
    Type^ returnType, 
    array<Type^>^ parameterTypes, 
    array<Attribute^>^ attributes, 
    MethodAttributes methodAttributes
)
member Add : 
        name:string * 
        returnType:Type * 
        parameterTypes:Type[] * 
        attributes:Attribute[] * 
        methodAttributes:MethodAttributes -> int
public function Add(
    name : String, 
    returnType : Type, 
    parameterTypes : Type[], 
    attributes : Attribute[], 
    methodAttributes : MethodAttributes
) : int
Parameters
- name 
 Type: String- The name of the method to add. 
- returnType 
 Type: Type- The return type of the method. This should be typeof(void) for void return types. 
- parameterTypes
 Type: array<Type[]
- attributes 
 Type: array<Attribute[]- This parameter is used to configure the class member appropriately. The Add method only accepts the values of MemberAttributes that fit into the AccessMask or ScopeMask categories. 
- methodAttributes 
 Type: MethodAttributes- This parameter specifies additional event attributes for this member. The default method attribute is Public. The only method attributes supported today are Public and Static . 
Return Value
Type: Int32
The index at which the value has been added.
Exceptions
| Exception | Condition | 
|---|---|
| ArgumentNullException | name is nulla null reference (Nothing in Visual Basic). -or- returnType is nulla null reference (Nothing in Visual Basic). -or- An element in paramTypes is nulla null reference (Nothing in Visual Basic). -or- An element in attributes is nulla null reference (Nothing in Visual Basic). attributes and paramTypes properties may be nulla null reference (Nothing in Visual Basic). | 
| ArgumentException | handlerType is not a run-time type. | 
.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.