Redigeeri

Jagamisviis:


_Assembly.CreateInstance Method

Definition

Provides COM objects with version-independent access to the CreateInstance methods.

Overloads

CreateInstance(String)

Provides COM objects with version-independent access to the CreateInstance(String) method.

CreateInstance(String, Boolean)

Provides COM objects with version-independent access to the CreateInstance(String, Boolean) method.

CreateInstance(String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[])

Provides COM objects with version-independent access to the CreateInstance(String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[]) method.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The CreateInstance methods locate a type from this assembly and create an instance of it using the system activator.

CreateInstance(String)

Provides COM objects with version-independent access to the CreateInstance(String) method.

public:
 System::Object ^ CreateInstance(System::String ^ typeName);
public object CreateInstance (string typeName);
abstract member CreateInstance : string -> obj
Public Function CreateInstance (typeName As String) As Object

Parameters

typeName
String

The FullName of the type to locate.

Returns

An 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.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The CreateInstance method locates the specified type from this assembly and creates an instance of it using the system activator, using case-sensitive search.

See also

Applies to

CreateInstance(String, Boolean)

Provides COM objects with version-independent access to the CreateInstance(String, Boolean) method.

public:
 System::Object ^ CreateInstance(System::String ^ typeName, bool ignoreCase);
public object CreateInstance (string typeName, bool ignoreCase);
abstract member CreateInstance : string * bool -> obj
Public Function CreateInstance (typeName As String, ignoreCase As Boolean) As Object

Parameters

typeName
String

The FullName of the type to locate.

ignoreCase
Boolean

true to ignore the case of the type name; otherwise, false.

Returns

An 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.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The CreateInstance method locates the specified type from this assembly and creates an instance of it using the system activator, with optional case-sensitive search.

See also

Applies to

CreateInstance(String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[])

Provides COM objects with version-independent access to the CreateInstance(String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[]) method.

public:
 System::Object ^ CreateInstance(System::String ^ typeName, bool ignoreCase, System::Reflection::BindingFlags bindingAttr, System::Reflection::Binder ^ binder, cli::array <System::Object ^> ^ args, System::Globalization::CultureInfo ^ culture, cli::array <System::Object ^> ^ activationAttributes);
public object CreateInstance (string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, object[] args, System.Globalization.CultureInfo culture, object[] activationAttributes);
abstract member CreateInstance : string * bool * System.Reflection.BindingFlags * System.Reflection.Binder * obj[] * System.Globalization.CultureInfo * obj[] -> obj
Public Function CreateInstance (typeName As String, ignoreCase As Boolean, bindingAttr As BindingFlags, binder As Binder, args As Object(), culture As CultureInfo, activationAttributes As Object()) As Object

Parameters

typeName
String

The FullName of the type to locate.

ignoreCase
Boolean

true to ignore the case of the type name; otherwise, false.

bindingAttr
BindingFlags

A bitmask that affects how the search is conducted. The value is a combination of bit flags from BindingFlags.

binder
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.

args
Object[]

An array of type Object containing 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 parameterless constructor is desired, args must be an empty array or null.

culture
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.)

activationAttributes
Object[]

An array of type Object containing one or more activation attributes that can participate in the activation.

Returns

An instance of Object representing the type and matching the specified criteria, or null if typeName is not found.

Remarks

This method is for access to managed classes from unmanaged code, and should not be called from managed code.

The CreateInstance method 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.

An example of an activation attribute for the activationAttributes parameter is: URLAttribute(http://hostname/appname/objectURI).

See also

Applies to