Invokes the method reflected by this instance using the given parameters
[Visual Basic] Overloads Public Function Invoke( _ ByVal obj As Object, _ ByVal parameters() As Object _ ) As Object [C#] public object Invoke( object obj, object[] parameters ); [C++] public: Object* Invoke( Object* obj, Object* parameters[] ); [JScript] public function Invoke( obj : Object, parameters : Object[] ) : Object;
Returns a Variant containing the return value of the invoked method.
Exception Type | Condition |
---|---|
TargetException | obj is null.
The method is non-static and it is not declared or inherited by the class of obj. |
ArgumentException | The number, type and order of parameters do not match the signature of the method reflected by this instance. |
AccessException | The caller does not have permission to invoke the method.
The method invoked is a class initializer. |
This method is a convenience method that calls the following Invoke method, passing null in the other parameters.
If the invoked method throws an exception, TargetInvocationException.GetException() returns the exception.
You may not omit optional parameters with the Invoke method. If you must do so, use Type.InvokeMember instead.
MethodInfo Class | MethodInfo Members | System.Reflection Namespace | MethodInfo.Invoke Overload List