Dynamically invokes the method reflected by this instance on the given object, passing along the specified parameters, and under the constraints of the given binder.
[Visual Basic] Overrides Public Function Invoke( _ ByVal obj As Object, _ ByVal invokeAttr As BindingFlags, _ ByVal binder As Binder, _ ByVal parameters() As Object, _ ByVal culture As CultureInfo _ ) As Object [C#] public override object Invoke( object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture ); [C++] public: override Object* Invoke( Object* obj, BindingFlags invokeAttr, Binder* binder, Object* parameters[], CultureInfo* culture ); [JScript] public override function Invoke( obj : Object, invokeAttr : BindingFlags, binder : Binder, parameters : Object[], culture : CultureInfo ) : Object;
Returns a Variant containing the return value of the invoked method.
Exception Type | Condition |
---|---|
NotSupportedException | This method is not currently supported. The workaround is to retrieve the constructor using GetMethod and call Invoke on the returned MethodInfo. |
If the method is static, the obj parameter is ignored. For non-static methods, obj should be an instance of a class that inherits or declares the method and must be the same type as this class. If the method has no parameters, the value of parameters should be a null reference (Nothing). Otherwise the number, type, and order of elements in the parameters array should be identical to the number, type, and order of parameters for the method reflected by this instance.
Note: Access restrictions are ignored for fully trusted code. That is, private constructors, methods, fields, and properties can be accessed and invoked via Reflection whenever the code is fully trusted.
MethodBuilder Class | MethodBuilder Members | System.Reflection.Emit Namespace