Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

ObjectUtils.InstantiateType(ConstructorInfo, Object) Method

Convenience method to instantiate a Type using the given constructor.

[Visual Basic]
Public Overloads Shared Sub InstantiateType( _
   ByVal constructor As ConstructorInfo, _
   ByVal arguments As Object _
)
[C#]
public static object InstantiateType(
   ConstructorInfo constructor,
   object[] arguments
);

Parameters

constructor
The constructor to use for the instantiation.
arguments
The arguments to be passed to the constructor.

Return Value

A new instance.

Remarks

As this method doesn't try to instantiate Types by name, it should avoid Type loading issues.

Exceptions

Exception Type Condition
ArgumentNullException If the constructor is a null reference (Nothing in Visual Basic)
FatalReflectionException If the constructor's declaring type is an abstract class, an interface, an open generic type or does not have a public no-argument constructor.

See Also

ObjectUtils Class | Spring.Util Namespace | ObjectUtils.InstantiateType Overload List