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.)
- Type: System.Object
An array of one or more attributes that can participate in activation. Typically, an array that contains a single UrlAttribute object that specifies the URL that is required to activate a remote object. This parameter is related to client-activated objects. Client activation is a legacy technology that is retained for backward compatibility but is not recommended for new development. Distributed applications should instead use Windows Communication Foundation.
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 that was compiled for a version of the runtime that is later than the currently loaded version.