ReflectorCreateInstance(ConstructorInfo, ReflectionWays, Object) Method

Creates a new instance by a ConstructorInfo specified in the ctor parameter.

Definition

Namespace: KGySoft.Reflection
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.0.0
C#
public static Object CreateInstance(
	ConstructorInfo ctor,
	ReflectionWays way,
	params Object?[]? parameters
)

Parameters

ctor  ConstructorInfo
The constructor to be invoked.
way  ReflectionWays
The preferred reflection way. TypeDescriptor way is not applicable here.
parameters  Object
The parameters to be used for invoking the constructor.

Return Value

Object
The return value of the method.

Remarks

If way is Auto, then the DynamicDelegate way will be used.

  Note

To invoke the constructor explicitly by dynamically created delegates use the CreateInstanceAccessor class.

See Also