_AppDomain.CreateInstance 方法

定义

为 COM 对象提供对 CreateInstance 方法的与版本无关的访问。Provides COM objects with version-independent access to the CreateInstance method.

重载

CreateInstance(String, String)

为 COM 对象提供对 CreateInstance(String, String) 方法的与版本无关的访问。Provides COM objects with version-independent access to the CreateInstance(String, String) method.

CreateInstance(String, String, Object[])

为 COM 对象提供对 CreateInstance(String, String, Object[]) 方法重载的与版本无关的访问权限。Provides COM objects with version-independent access to the CreateInstance(String, String, Object[]) method overload.

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

为 COM 对象提供对 CreateInstance(String, String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[], Evidence) 方法重载的与版本无关的访问权限。Provides COM objects with version-independent access to the CreateInstance(String, String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[], Evidence) method overload.

CreateInstance(String, String)

为 COM 对象提供对 CreateInstance(String, String) 方法的与版本无关的访问。Provides COM objects with version-independent access to the CreateInstance(String, String) method.

public:
 System::Runtime::Remoting::ObjectHandle ^ CreateInstance(System::String ^ assemblyName, System::String ^ typeName);
public System.Runtime.Remoting.ObjectHandle CreateInstance (string assemblyName, string typeName);
abstract member CreateInstance : string * string -> System.Runtime.Remoting.ObjectHandle
Public Function CreateInstance (assemblyName As String, typeName As String) As ObjectHandle

参数

assemblyName
String

程序集的显示名称。The display name of the assembly. 请参阅 FullNameSee FullName.

typeName
String

FullName 属性返回的所请求类型的完全限定名称,包含命名空间而不是程序集。The fully qualified name of the requested type, including the namespace but not the assembly, as returned by the FullName property.

返回

一个对象,该对象是 typeName 指定的新实例的包装。An object that is a wrapper for the new instance specified by typeName. 返回值需要打开包装才能访问真实对象。The return value needs to be unwrapped to access the real object.

注解

请参见AppDomain.CreateInstance方法。See the AppDomain.CreateInstance method.

CreateInstance(String, String, Object[])

为 COM 对象提供对 CreateInstance(String, String, Object[]) 方法重载的与版本无关的访问权限。Provides COM objects with version-independent access to the CreateInstance(String, String, Object[]) method overload.

public:
 System::Runtime::Remoting::ObjectHandle ^ CreateInstance(System::String ^ assemblyName, System::String ^ typeName, cli::array <System::Object ^> ^ activationAttributes);
public System.Runtime.Remoting.ObjectHandle CreateInstance (string assemblyName, string typeName, object[] activationAttributes);
abstract member CreateInstance : string * string * obj[] -> System.Runtime.Remoting.ObjectHandle
Public Function CreateInstance (assemblyName As String, typeName As String, activationAttributes As Object()) As ObjectHandle

参数

assemblyName
String

程序集的显示名称。The display name of the assembly. 请参阅 FullNameSee FullName.

typeName
String

FullName 属性返回的所请求类型的完全限定名称,包含命名空间而不是程序集。The fully qualified name of the requested type, including the namespace but not the assembly, as returned by the FullName property.

activationAttributes
Object[]

包含一个或多个可以参与激活的特性的数组。An array of one or more attributes that can participate in activation. 通常是包含单个 UrlAttribute 对象的数组。Typically, an array that contains a single UrlAttribute object. UrlAttribute 指定激活远程对象所需的 URL。The UrlAttribute specifies the URL that is required to activate a remote object.

返回

一个对象,该对象是 typeName 指定的新实例的包装。An object that is a wrapper for the new instance specified by typeName. 返回值需要打开包装才能访问真实对象。The return value needs to be unwrapped to access the real object.

注解

请参阅AppDomain.CreateInstance(String, String, Object[])方法重载。See the AppDomain.CreateInstance(String, String, Object[]) method overload.

activationAttributes参数与客户端激活的对象(一种旧技术)相关。The activationAttributes parameter is related to client-activated objects, a legacy technology.

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

为 COM 对象提供对 CreateInstance(String, String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[], Evidence) 方法重载的与版本无关的访问权限。Provides COM objects with version-independent access to the CreateInstance(String, String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[], Evidence) method overload.

public:
 System::Runtime::Remoting::ObjectHandle ^ CreateInstance(System::String ^ assemblyName, 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, System::Security::Policy::Evidence ^ securityAttributes);
public System.Runtime.Remoting.ObjectHandle CreateInstance (string assemblyName, string typeName, bool ignoreCase, System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder, object[] args, System.Globalization.CultureInfo culture, object[] activationAttributes, System.Security.Policy.Evidence securityAttributes);
abstract member CreateInstance : string * string * bool * System.Reflection.BindingFlags * System.Reflection.Binder * obj[] * System.Globalization.CultureInfo * obj[] * System.Security.Policy.Evidence -> System.Runtime.Remoting.ObjectHandle

参数

assemblyName
String

程序集的显示名称。The display name of the assembly. 请参阅 FullNameSee FullName.

typeName
String

FullName 属性返回的所请求类型的完全限定名称,包含命名空间而不是程序集。The fully qualified name of the requested type, including the namespace but not the assembly, as returned by the FullName property.

ignoreCase
Boolean

一个布尔值,指示是否执行区分大小写的搜索。A Boolean value specifying whether to perform a case-sensitive search or not.

bindingAttr
BindingFlags

影响 typeName 构造函数搜索的零个或多个位标志的组合。A combination of zero or more bit flags that affect the search for the typeName constructor. 如果 bindingAttr 为零,则对公共构造函数进行区分大小写的搜索。If bindingAttr is zero, a case-sensitive search for public constructors is conducted.

binder
Binder

一个对象,它使用反射启用绑定、参数类型的强制、成员的调用和 MemberInfo 对象的检索。An object that enables the binding, coercion of argument types, invocation of members, and retrieval of MemberInfo objects using reflection. 如果 binder 为 null,则使用默认联编程序。If binder is null, the default binder is used.

args
Object[]

要传递给构造函数的实参。The arguments to pass to the constructor. 此实参数组必须在数量、顺序和类型方面与要调用的构造函数的形参匹配。This array of arguments must match in number, order, and type the parameters of the constructor to invoke. 如果无参数构造函数是首选,则 args 必须为空数组或 NULL。If the parameterless constructor is preferred, args must be an empty array or null.

culture
CultureInfo

区域性特定的信息,这些信息控制将 args 强制转换为 typeName 构造函数所声明的正式类型。Culture-specific information that governs the coercion of args to the formal types declared for the typeName constructor. 如果 culturenull,则使用当前线程的 CultureInfoIf culture is null, the CultureInfo for the current thread is used.

activationAttributes
Object[]

包含一个或多个可以参与激活的特性的数组。An array of one or more attributes that can participate in activation. 通常是包含单个 UrlAttribute 对象的数组。Typically, an array that contains a single UrlAttribute object. UrlAttribute 指定激活远程对象所需的 URL。The UrlAttribute specifies the URL that is required to activate a remote object.

securityAttributes
Evidence

用于授权创建 typeName 的信息。Information used to authorize creation of typeName.

返回

一个对象,该对象是 typeName 指定的新实例的包装。An object that is a wrapper for the new instance specified by typeName. 返回值需要打开包装才能访问真实对象。The return value needs to be unwrapped to access the real object.

注解

请参阅AppDomain.CreateInstance(String, String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[], Evidence)方法重载。See the AppDomain.CreateInstance(String, String, Boolean, BindingFlags, Binder, Object[], CultureInfo, Object[], Evidence) method overload.

activationAttributes参数与客户端激活的对象(一种旧技术)相关。The activationAttributes parameter is related to client-activated objects, a legacy technology.

适用于