Assembly.CreateInstance Method (String, Boolean, BindingFlags, Binder, Object, CultureInfo, Object)
Locates the specified type from this assembly and creates an instance of it using the system activator, with optional case-sensitive search and having the specified culture, arguments, and binding and activation attributes.
Assembly: mscorlib (in mscorlib.dll)
public virtual Object CreateInstance( string typeName, bool ignoreCase, BindingFlags bindingAttr, Binder binder, Object args, CultureInfo culture, Object activationAttributes )
- Type: System.Boolean
true to ignore the case of the type name; otherwise, false.
- Type: System.Reflection.BindingFlags
A bitmask that affects the way in which the search is conducted. The value is a combination of bit flags from BindingFlags.
- Type: System.Reflection.Binder
An object that enables the binding, coercion of argument types, invocation of members, and retrieval of MemberInfo objects via reflection. If binder is null, the default binder is used.
- Type: System.Object
An array that contains the arguments to be passed to the constructor. This array of arguments must match in number, order, and type the parameters of the constructor to be invoked. If the default constructor is desired, args must be an empty array or null.
- Type: System.Globalization.CultureInfo
An instance of CultureInfo used to govern the coercion of types. If this is null, the CultureInfo for the current thread is used. (This is necessary to convert a String that represents 1000 to a Double value, for example, since 1000 is represented differently by different cultures.)
Return ValueType: System.Object
An instance of the specified type, or null if typeName is not found. The supplied arguments are used to resolve the type, and to bind the constructor that is used to create the instance.
Implements_Assembly.CreateInstance(String, Boolean, BindingFlags, Binder, Object, CultureInfo, Object)
typeName is an empty string ("") or a string beginning with a null character.
The current assembly was loaded into the reflection-only context.
typeName is null.
No matching constructor was found.
A non-empty activation attributes array is passed to a type that does not inherit from MarshalByRefObject.
typeName requires a dependent assembly that could not be found.
typeName requires a dependent assembly that was found but could not be loaded.
The current assembly was loaded into the reflection-only context, and typeName requires a dependent assembly that was not preloaded.
typeName requires a dependent assembly, but the file is not a valid assembly.
typeName requires a dependent assembly which was compiled for a version of the runtime later than the currently loaded version.
The activationAttributes parameter is related to client-activated objects; see Client Activation.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.