_AppDomain.CreateInstanceFrom 方法

定义

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

重载

CreateInstanceFrom(String, String)

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

CreateInstanceFrom(String, String, Object[])

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

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

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

CreateInstanceFrom(String, String)

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

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

参数

assemblyFile
String

文件的名称(包括路径),该文件包含定义所请求类型的程序集。The name, including the path, of a file that contains an assembly that defines the requested type. 该程序集是使用 LoadFrom(String) 方法加载的。The assembly is loaded using the LoadFrom(String) method.

typeName
String

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

返回

一个对象,它是新实例的包装,或者如果找不到 null,则为 typeNameAn object that is a wrapper for the new instance, or null if typeName is not found. 返回值需要打开包装才能访问真实对象。The return value needs to be unwrapped to access the real object.

注解

请参阅AppDomain.CreateInstanceFrom(String, String)方法重载。See the AppDomain.CreateInstanceFrom(String, String) method overload.

CreateInstanceFrom(String, String, Object[])

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

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

参数

assemblyFile
String

文件的名称(包括路径),该文件包含定义所请求类型的程序集。The name, including the path, of a file that contains an assembly that defines the requested type. 该程序集是使用 LoadFrom(String) 方法加载的。The assembly is loaded using the LoadFrom(String) method.

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.

返回

一个对象,它是新实例的包装,或者如果找不到 null,则为 typeNameAn object that is a wrapper for the new instance, or null if typeName is not found. 返回值需要打开包装才能访问真实对象。The return value needs to be unwrapped to access the real object.

注解

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

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

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

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

public:
 System::Runtime::Remoting::ObjectHandle ^ CreateInstanceFrom(System::String ^ assemblyFile, 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 CreateInstanceFrom (string assemblyFile, 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 CreateInstanceFrom : string * string * bool * System.Reflection.BindingFlags * System.Reflection.Binder * obj[] * System.Globalization.CultureInfo * obj[] * System.Security.Policy.Evidence -> System.Runtime.Remoting.ObjectHandle

参数

assemblyFile
String

文件的名称(包括路径),该文件包含定义所请求类型的程序集。The name, including the path, of a file that contains an assembly that defines the requested type. 该程序集是使用 LoadFrom(String) 方法加载的。The assembly is loaded using the LoadFrom(String) method.

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

返回

一个对象,它是新实例的包装,或者如果找不到 null,则为 typeNameAn object that is a wrapper for the new instance, or null if typeName is not found. 返回值需要打开包装才能访问真实对象。The return value needs to be unwrapped to access the real object.

注解

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

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

适用于