System.Activator.CreateInstanceFrom Method

Creates an instance of the type whose name is specified, using the named assembly file and default constructor.

Syntax

public static System.Runtime.Remoting.ObjectHandle CreateInstanceFrom (string assemblyFile, string typeName)

Parameters

assemblyFile
The name of a file that contains an assembly where the type named typeName is sought.
typeName
The name of the preferred type.

Returns

A handle that must be unwrapped to access the newly created instance.

Remarks

Use the System.Runtime.Remoting.ObjectHandle.Unwrap method to unwrap the return value.

For information about other exceptions that can be thrown by invoked methods, see the Exceptions section of the System.Reflection.Assembly.LoadFrom(string) and Activator.CreateInstance(Type, System.Reflection.BindingFlags, System.Reflection.Binder, Object[], System.Globalization.CultureInfo) methods.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0