ConstructorInfo.Invoke Method (array<Object>[]()[])

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Invokes the current constructor with the specified arguments.

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

Syntax

Public Function Invoke ( _
    parameters As Object() _
) As Object
public Object Invoke(
    Object[] parameters
)

Parameters

  • parameters
    Type: array<System..::.Object>[]()[]
    An array of values that matches the number, order, and type (under the constraints of the default binder) of the parameters for this constructor. If this constructor takes no parameters, pass nullNothingnullptra null reference (Nothing in Visual Basic) or an array with zero elements; for example, new Object[] {} (New Object() {} in Visual Basic). 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 nullNothingnullptra null reference (Nothing in Visual Basic). For value-type elements, this value is 0, 0.0, or false, depending on the specific element type.

Return Value

Type: System..::.Object
An instance of the class that is associated with the constructor.

Exceptions

Exception Condition
MemberAccessException

The class is abstract.

-or-

The constructor is a class initializer.

MethodAccessException

The constructor is private or protected.

ArgumentException

The parameters array does not contain values that match the types accepted by this constructor.

TargetInvocationException

The invoked constructor throws an exception.

TargetParameterCountException

An incorrect number of parameters was passed.

NotSupportedException

Creation of TypedReference and RuntimeArgumentHandle types is not supported.

Remarks

In Windows Phone, you can invoke only accessible constructors.

The number, type, and order of elements in the parameters array must match the number, type, and order of parameters for the constructor reflected by this instance, as determined by the default binder.

Version Notes

Windows Phone

Invoke throws an ArgumentException exception instead of a TargetParameterCountException exception when there is a mismatch in the number of arguments.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Platforms

Windows Phone

See Also

Reference

ConstructorInfo Class

Invoke Overload

System.Reflection Namespace