ConstructorInfoInvoke Method (Object) |
Invokes the constructor reflected by the instance that has the specified parameters, providing default values for the parameters not commonly used.
Namespace: System.ReflectionAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax public Object Invoke(
Object[] parameters
)
Parameters
- parameters
- Type: SystemObject
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, then use either an array with zero elements or null, as in Object[] parameters = new Object[0]. 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.
Return Value
Type:
ObjectAn instance of the class 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, and the caller lacks MemberAccess. |
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, ArgIterator, and RuntimeArgumentHandle types is not supported. |
SecurityException | The caller does not have the necessary code access permission. |
See Also