Invokes the method or constructor reflected by the current instance on the specified object and using the specified arguments.
- obj
- An instance of a type that contains the constructor or method reflected by the current instance. If the member is static, obj is ignored. For non-static methods, obj is an instance of a class that inherits or declares the method.
- parameters
- An array objects that match the number, order and type of the parameters for the constructor or method reflected by the current instance. If the member reflected by the current instance takes no parameters, specify either an array with zero elements or null .
Note: Any object in this array that is not explicitly initialized with a value will contain the default value for that object type. For reference-type elements, this value is null. For value-type elements, this value is 0, 0.0, or false, depending on the specific element type. If the method or constructor reflected by the current instance is static , this parameter is ignored.- parameters
- Documentation for this section has not yet been entered.
A object that contains the return value of the invoked method, or a re-initialized object if a constructor was invoked.
Type Reason System.Security.Permissions.ReflectionPermission Requires permission to invoke non-public members of loaded assemblies. See System.Security.Permissions.ReflectionPermissionFlag.MemberAccess.
Type Reason ArgumentException The types of the elements of parameters do not match the types of the parameters accepted by the constructor or method reflected by the current instance, under the constraints of the default binder. System.Reflection.TargetException The constructor or method reflected by the current instance is non-static and obj is null, or is of a type that does not implement the member reflected by the current instance. System.Reflection.TargetInvocationException The constructor or method reflected by the current instance threw an exception. System.Reflection.TargetParameterCountException parameters.Length does not equal the number of parameters required by the contract of the member reflected by the current instance. MemberAccessException The caller does not have permission to execute the method or constructor. InvalidOperationException The type that declares the method is an open generic type. That is, Type.ContainsGenericParameters returns true for the declaring type.
This version of MethodBase.Invoke(object, Object[]) is equivalent to MethodBase.Invoke(object, Object[])(obj, (BindingFlags)0, null, parameters, null).
Optional parameters cannot be omitted in calls to MethodBase.Invoke(object, Object[]) .
Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0