AppDomain.CreateInstanceAndUnwrap Method (String, String, Object)
Creates a new instance of the specified type. Parameters specify the assembly where the type is defined, the name of the type, and an array of activation attributes.
Assembly: mscorlib (in mscorlib.dll)
member CreateInstanceAndUnwrap : assemblyName:string * typeName:string * activationAttributes:Object -> Object
- Type: System.String
The fully qualified name of the requested type, including the namespace but not the assembly, as returned by the Type.FullName property.
Return ValueType: System.Object
An instance of the object specified by typeName.
assemblyName or typeName is a null reference (Nothing in Visual Basic).
No matching public constructor was found.
typename was not found in assemblyName.
assemblyName was not found.
The caller does not have permission to call this constructor.
The caller cannot provide activation attributes for an object that does not inherit from MarshalByRefObject.
The operation is attempted on an unloaded application domain.
assemblyName is not a valid assembly.
Version 2.0 or later of the common language runtime is currently loaded and assemblyName was compiled with a later version.
An assembly or module was loaded twice with two different evidences.
The activationAttributes parameter is related to client-activated objects; see Client Activation.
If you make an early-bound call to a method M of an object of type T1 that was returned by CreateInstanceAndUnwrap, and that method makes an early-bound call to a method of an object of type T2 in an assembly C other than the current assembly or the assembly containing T1, assembly C is loaded into the current application domain. This loading occurs even if the early-bound call to T1.M() was made in the body of a DynamicMethod, or in other dynamically generated code. If the current domain is the default domain, assembly C cannot be unloaded until the process ends. If the current domain later attempts to load assembly C, the load might fail.
for the ability to access the location of the assembly. Associated enumeration: FileIOPermissionAccess.PathDiscovery
for the ability to read the file containing the assembly manifest. Associated enumeration: FileIOPermissionAccess.Read
for the ability to access the location of the assembly if the assembly is not local.
for the ability to call unmanaged code when creating an instance of a delegate. Associated enumeration: SecurityPermissionFlag.UnmanagedCode
for the ability to invoke operations on all type members. Associated enumeration: ReflectionPermissionFlag.MemberAccess
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.