Compartir a través de


MethodBase.Invoke Method

Invokes the method or constructor reflected by the current MethodInfo object.

Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)

Syntax

[DebuggerHiddenAttribute]
[DebuggerStepThroughAttribute]
[MethodImplAttribute]
public Object Invoke (
         Object obj,
         Object[] parameters
)

Parameters

  • obj
    The object on which the method or constructor is to be invoked. If a method is static, this argument is ignored. If a constructor is static, this argument must be a null reference or an instance of the class that defines the constructor.

  • parameters
    An argument list for the invoked method or constructor. This is an array of objects with the same number, order, and type as the parameters of the method or constructor to be invoked. If there are no parameters, parameters should be a null reference

    If the method or constructor represented by this instance takes a reference parameter, no special attribute is required for that parameter to invoke the method or constructor by using this function. 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 a null reference. For value-type elements, this value is 0, 0.0, or false, depending on the specific element type.

Return Value

An object that contains the return value of the invoked method, or a null reference in the case of a constructor.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, 4.1, and 4.2.

See Also

Reference

MethodBase Class
MethodBase Members
System.Reflection Namespace