Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

ObjectUtils.InstantiateType(Type) Method

Convenience method to instantiate a Type using its no-arg constructor.

[Visual Basic]
Public Overloads Shared Sub InstantiateType( _
   ByVal type As Type _
public static object InstantiateType(
   Type type


The Type to instantiate*

Return Value

A new instance of the Type.


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


Exception Type Condition
ArgumentNullException If the type is a null reference (Nothing in Visual Basic)
FatalReflectionException If the 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