Assembly.CreateInstance Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Locates the specified type from this assembly and creates an instance of it using the system activator, using case-sensitive search.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- typeName
- Type: System.String
The Type.FullName of the type to locate.
Return Value
Type: System.ObjectAn instance of Object representing the type, with culture, arguments, binder, and activation attributes set to null, and BindingFlags set to Public or Instance, or null if typeName is not found.
| Exception | Condition |
|---|---|
| ArgumentException | typeName is an empty string ("") or a string beginning with a null character. |
| ArgumentNullException | typeName is null. |
| MissingMethodException | No matching constructor was found. |
| FileNotFoundException | typeName requires a dependent assembly that could not be found. |
| FileLoadException | typeName requires a dependent assembly that was found but could not be loaded. |
| BadImageFormatException | typeName requires a dependent assembly, but the file is not a valid assembly. -or- typeName requires a dependent assembly which was compiled for a version of the runtime later than the currently loaded version. |
| MemberAccessException | The method is invoked late-bound through mechanisms such as Type.InvokeMember. |