Creates an instance of the specified type using the specified constructor. The constructor that is to be invoked must be accessible and provide the most specific match with the specified argument list, under the constraints of the specified binder and binding attributes.
[Visual Basic] Overloads Public Shared Function CreateInstance( _ ByVal type As Type, _ ByVal bindingAttr As BindingFlags, _ ByVal binder As Binder, _ ByVal args() As Object, _ ByVal culture As CultureInfo _ ) As Object [C#] public static object CreateInstance( Type type, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture ); [C++] public: static Object* CreateInstance( Type* type, BindingFlags bindingAttr, Binder* binder, Object* args[], CultureInfo* culture ); [JScript] public static function CreateInstance( type : Type, bindingAttr : BindingFlags, binder : Binder, args : Object[], culture : CultureInfo ) : Object;
A reference to the newly created object.
Exception Type | Condition |
---|---|
AccessException | The caller does not have sufficient permissions to call this method. |
TargetInvocationException | The constructor being called throws an exception. |
Activator Class | Activator Members | System Namespace | Activator.CreateInstance Overload List