Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ConstructorBuilder::Invoke Method (Object^, BindingFlags, Binder^, array<Object^>^, CultureInfo^)

 

Dynamically invokes the constructor reflected by this instance with the specified arguments, under the constraints of the specified Binder.

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

public:
virtual Object^ Invoke(
	Object^ obj,
	BindingFlags invokeAttr,
	Binder^ binder,
	array<Object^>^ parameters,
	CultureInfo^ culture
) override

Parameters

obj
Type: System::Object^

The object that needs to be reinitialized.

invokeAttr
Type: System.Reflection::BindingFlags

One of the BindingFlags values that specifies the type of binding that is desired.

binder
Type: System.Reflection::Binder^

A Binder that defines a set of properties and enables the binding, coercion of argument types, and invocation of members using reflection. If binder is null, then Binder.DefaultBinding is used.

parameters
Type: array<System::Object^>^

An argument list. This is an array of arguments with the same number, order, and type as the parameters of the constructor to be invoked. If there are no parameters, this should be a null reference (Nothing in Visual Basic).

culture
Type: System.Globalization::CultureInfo^

A CultureInfo used to govern the coercion of types. If this is null, the CultureInfo for the current thread is used.

Return Value

Type: System::Object^

An instance of the class associated with the constructor.

Exception Condition
NotSupportedException

This method is not currently supported. You can retrieve the constructor using GetConstructor and call Invoke on the returned ConstructorInfo.

The number, type, and order of elements in the parameters array should be identical to the number, type, and order of parameters for the constructor reflected by this instance.

Before calling the constructor, Invoke ensures that the caller has access permission, and that the parameters are of the correct number, order and type.

Access restrictions are ignored for fully-trusted code. That is, private constructors, methods, fields, and properties can be accessed and invoked using Reflection whenever the code is fully trusted.

.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Return to top
Show:
© 2017 Microsoft