Export (0) Print
Expand All

ConstructorBuilder.Invoke Method (Object, BindingFlags, Binder, 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 override Object Invoke (
	Object obj,
	BindingFlags invokeAttr,
	Binder binder,
	Object[] parameters,
	CultureInfo culture
)
public Object Invoke (
	Object obj, 
	BindingFlags invokeAttr, 
	Binder binder, 
	Object[] parameters, 
	CultureInfo culture
)
public override function Invoke (
	obj : Object, 
	invokeAttr : BindingFlags, 
	binder : Binder, 
	parameters : Object[], 
	culture : CultureInfo
) : Object

Parameters

obj

The object that needs to be reinitialized.

invokeAttr

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

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 a null reference (Nothing in Visual Basic), then Binder.DefaultBinding is used.

parameters

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

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

Return Value

An instance of the class associated with the constructor.

Exception typeCondition

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.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft