.NET Framework Class Library
Assembly.CreateInstance Method (String)

Locates the specified type from this assembly and creates an instance of it using the system activator, using case-sensitive search.

[Visual Basic]
Overloads Public Function CreateInstance( _
   ByVal typeName As String _
) As Object
[C#]
public object CreateInstance(
 string typeName
);
[C++]
public: Object* CreateInstance(
 String* typeName
);
[JScript]
public function CreateInstance(
   typeName : String
) : Object;

Parameters

typeName
The Type.FullName of the type to locate.

Return Value

An instance of Object representing the type, with culture, arguments, binder, and activation attributes set to a null reference (Nothing in Visual Basic), and BindingFlags set to Public or Instance, or a null reference (Nothing) if typeName is not found.

Exceptions

Exception Type Condition
ArgumentException typeName is the empty string ("") or "\0anything"

-or-

The length of typeName exceeds 1024 characters.

ArgumentNullException typeName is a null reference (Nothing in Visual Basic).
MissingMethodException No matching constructor was found.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

.NET Framework Security: 

See Also

Assembly Class | Assembly Members | System.Reflection Namespace | Assembly.CreateInstance Overload List

Page view tracker