Click or drag to resize

ExtensionsReflectionCreateInstance Method (ConstructorInfo, Object)

Creates an instance of the specified type using the constructor

Namespace:  Cauldron
Assembly:  Cauldron.Activator (in Cauldron.Activator.dll) Version: 3.2.0.1 (3.2.0.1)
Syntax
C#
public static Object CreateInstance(
	this ConstructorInfo ctor,
	Object[] args
)

Parameters

ctor
Type: System.ReflectionConstructorInfo
The constructor use to construct the instance
args
Type: SystemObject
An array of arguments that match in number, order, and type the parameters of the constructor to invoke. If args is an empty array or null, the constructor that takes no parameters (the default constructor) is invoked.

Return Value

Type: Object
A reference to the newly created object.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type ConstructorInfo. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
ArgumentNullExceptionctor is null
See Also