_Type.InvokeMember _Type.InvokeMember _Type.InvokeMember Method

定义

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

重载

InvokeMember(String, BindingFlags, Binder, Object, Object[]) InvokeMember(String, BindingFlags, Binder, Object, Object[]) InvokeMember(String, BindingFlags, Binder, Object, Object[])

为 COM 对象提供对 InvokeMember(String, BindingFlags, Binder, Object, Object[]) 方法的版本无关的访问。Provides COM objects with version-independent access to the InvokeMember(String, BindingFlags, Binder, Object, Object[]) method.

InvokeMember(String, BindingFlags, Binder, Object, Object[], CultureInfo) InvokeMember(String, BindingFlags, Binder, Object, Object[], CultureInfo) InvokeMember(String, BindingFlags, Binder, Object, Object[], CultureInfo)

为 COM 对象提供对 InvokeMember(String, BindingFlags, Binder, Object, Object[], CultureInfo) 方法的版本无关的访问。Provides COM objects with version-independent access to the InvokeMember(String, BindingFlags, Binder, Object, Object[], CultureInfo) method.

InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]) InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]) InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[])

为 COM 对象提供对 InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]) 方法的版本无关的访问。Provides COM objects with version-independent access to the InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]) method.

注解

此方法用于访问托管类到从非托管代码,不应从托管代码调用。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.InvokeMember方法将调用特定成员的当前TypeThe Type.InvokeMember method invokes a specific member of the current Type.

..

InvokeMember(String, BindingFlags, Binder, Object, Object[]) InvokeMember(String, BindingFlags, Binder, Object, Object[]) InvokeMember(String, BindingFlags, Binder, Object, Object[])

为 COM 对象提供对 InvokeMember(String, BindingFlags, Binder, Object, Object[]) 方法的版本无关的访问。Provides COM objects with version-independent access to the InvokeMember(String, BindingFlags, Binder, Object, Object[]) method.

public:
 System::Object ^ InvokeMember(System::String ^ name, System::Reflection::BindingFlags invokeAttr, System::Reflection::Binder ^ binder, System::Object ^ target, cli::array <System::Object ^> ^ args);
public object InvokeMember (string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object target, object[] args);
abstract member InvokeMember : string * System.Reflection.BindingFlags * System.Reflection.Binder * obj * obj[] -> obj

参数

name
String String String

String,它包含要调用的构造函数、方法、属性或字段成员的名称。The String containing the name of the constructor, method, property, or field member to invoke.

-or- 空字符串 (""),表示调用默认成员。An empty string ("") to invoke the default member.

-or- 对于 IDispatch 成员,一个表示 DispID 的字符串,例如“[DispID=3]”。For IDispatch members, a string representing the DispID, for example "[DispID=3]".

invokeAttr
BindingFlags BindingFlags BindingFlags

一个位屏蔽,由一个或多个指定搜索执行方式的 BindingFlags 组成。A bitmask comprised of one or more BindingFlags that specify how the search is conducted. 访问可以是 BindingFlags 之一,如 PublicNonPublicPrivateInvokeMethodGetField 等。The access can be one of the BindingFlags such as Public, NonPublic, Private, InvokeMethod, GetField, and so on. 查找类型无需指定。The type of lookup need not be specified. 如果省略查找的类型,则将使用 BindingFlags.Public | BindingFlags.InstanceIf the type of lookup is omitted, BindingFlags.Public | BindingFlags.Instance will apply.

binder
Binder Binder Binder

一个 Binder 对象,该对象定义一组属性并启用绑定,而绑定可能涉及选择重载方法、强制转换参数类型和通过反射调用成员。A Binder object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection.

- 或 --or- 若为 null,则使用 DefaultBindernull, to use the DefaultBinder.

target
Object Object Object

要在其上调用指定成员的 ObjectThe Object on which to invoke the specified member.

args
Object[]

包含传递给要调用的成员的参数的数组。An array containing the arguments to pass to the member to invoke.

返回

表示被调用成员的返回值的 ObjectAn Object representing the return value of the invoked member.

注解

此方法用于访问托管类到从非托管代码,不应从托管代码调用。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.InvokeMember方法调用使用指定的绑定约束并匹配指定的参数列表的指定的成员。The Type.InvokeMember method invokes the specified member, using the specified binding constraints and matching the specified argument list.

InvokeMember(String, BindingFlags, Binder, Object, Object[], CultureInfo) InvokeMember(String, BindingFlags, Binder, Object, Object[], CultureInfo) InvokeMember(String, BindingFlags, Binder, Object, Object[], CultureInfo)

为 COM 对象提供对 InvokeMember(String, BindingFlags, Binder, Object, Object[], CultureInfo) 方法的版本无关的访问。Provides COM objects with version-independent access to the InvokeMember(String, BindingFlags, Binder, Object, Object[], CultureInfo) method.

public:
 System::Object ^ InvokeMember(System::String ^ name, System::Reflection::BindingFlags invokeAttr, System::Reflection::Binder ^ binder, System::Object ^ target, cli::array <System::Object ^> ^ args, System::Globalization::CultureInfo ^ culture);
public object InvokeMember (string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object target, object[] args, System.Globalization.CultureInfo culture);
abstract member InvokeMember : string * System.Reflection.BindingFlags * System.Reflection.Binder * obj * obj[] * System.Globalization.CultureInfo -> obj

参数

name
String String String

String,它包含要调用的构造函数、方法、属性或字段成员的名称。The String containing the name of the constructor, method, property, or field member to invoke.

- 或 --or- 空字符串 (""),表示调用默认成员。An empty string ("") to invoke the default member.

- 或 --or- 对于 IDispatch 成员,一个表示 DispID 的字符串,例如“[DispID=3]”。For IDispatch members, a string representing the DispID, for example "[DispID=3]".

invokeAttr
BindingFlags BindingFlags BindingFlags

一个位屏蔽,由一个或多个指定搜索执行方式的 BindingFlags 组成。A bitmask comprised of one or more BindingFlags that specify how the search is conducted. 访问可以是 BindingFlags 之一,如 PublicNonPublicPrivateInvokeMethodGetField 等。The access can be one of the BindingFlags such as Public, NonPublic, Private, InvokeMethod, GetField, and so on. 查找类型无需指定。The type of lookup need not be specified. 如果省略查找的类型,则将使用 BindingFlags.Public | BindingFlags.InstanceIf the type of lookup is omitted, BindingFlags.Public | BindingFlags.Instance will apply.

binder
Binder Binder Binder

一个 Binder 对象,该对象定义一组属性并启用绑定,而绑定可能涉及选择重载方法、强制转换参数类型和通过反射调用成员。A Binder object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection.

- 或 --or- 若为 null,则使用 DefaultBindernull, to use the DefaultBinder.

target
Object Object Object

要在其上调用指定成员的 ObjectThe Object on which to invoke the specified member.

args
Object[]

包含传递给要调用的成员的参数的数组。An array containing the arguments to pass to the member to invoke.

culture
CultureInfo CultureInfo CultureInfo

表示要使用的全局化区域设置的 CultureInfo 对象,它对区域设置特定的转换可能是必需的,比如将数字 String 转换为 Double。The CultureInfo object representing the globalization locale to use, which may be necessary for locale-specific conversions, such as converting a numeric String to a Double.

-or- null,表示使用当前线程的 CultureInfonull to use the current thread's CultureInfo.

返回

表示被调用成员的返回值的 ObjectAn Object representing the return value of the invoked member.

注解

此方法用于访问托管类到从非托管代码,不应从托管代码调用。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.InvokeMember方法调用使用指定的绑定约束并匹配指定的参数列表和区域性的指定的成员。The Type.InvokeMember method invokes the specified member, using the specified binding constraints and matching the specified argument list and culture.

InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]) InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]) InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[])

为 COM 对象提供对 InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]) 方法的版本无关的访问。Provides COM objects with version-independent access to the InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]) method.

public:
 System::Object ^ InvokeMember(System::String ^ name, System::Reflection::BindingFlags invokeAttr, System::Reflection::Binder ^ binder, System::Object ^ target, cli::array <System::Object ^> ^ args, cli::array <System::Reflection::ParameterModifier> ^ modifiers, System::Globalization::CultureInfo ^ culture, cli::array <System::String ^> ^ namedParameters);
public object InvokeMember (string name, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object target, object[] args, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, string[] namedParameters);
abstract member InvokeMember : string * System.Reflection.BindingFlags * System.Reflection.Binder * obj * obj[] * System.Reflection.ParameterModifier[] * System.Globalization.CultureInfo * string[] -> obj

参数

name
String String String

String,它包含要调用的构造函数、方法、属性或字段成员的名称。The String containing the name of the constructor, method, property, or field member to invoke.

- 或 --or- 空字符串 (""),表示调用默认成员。An empty string ("") to invoke the default member.

-or- 对于 IDispatch 成员,一个表示 DispID 的字符串,例如“[DispID=3]”。For IDispatch members, a string representing the DispID, for example "[DispID=3]".

invokeAttr
BindingFlags BindingFlags BindingFlags

一个位屏蔽,由一个或多个指定搜索执行方式的 BindingFlags 组成。A bitmask comprised of one or more BindingFlags that specify how the search is conducted. 访问可以是 BindingFlags 之一,如 PublicNonPublicPrivateInvokeMethodGetField 等。The access can be one of the BindingFlags such as Public, NonPublic, Private, InvokeMethod, GetField, and so on. 查找类型无需指定。The type of lookup need not be specified. 如果省略查找的类型,则将使用 BindingFlags.Public | BindingFlags.InstanceIf the type of lookup is omitted, BindingFlags.Public | BindingFlags.Instance will apply.

binder
Binder Binder Binder

一个 Binder 对象,该对象定义一组属性并启用绑定,而绑定可能涉及选择重载方法、强制转换参数类型和通过反射调用成员。A Binder object that defines a set of properties and enables binding, which can involve selection of an overloaded method, coercion of argument types, and invocation of a member through reflection.

-or- 若为 null,则使用 DefaultBindernull, to use the DefaultBinder.

target
Object Object Object

要在其上调用指定成员的 ObjectThe Object on which to invoke the specified member.

args
Object[]

包含传递给要调用的成员的参数的数组。An array containing the arguments to pass to the member to invoke.

modifiers
ParameterModifier[]

ParameterModifier 对象的数组,表示与 args 数组中的相应元素关联的特性。An array of ParameterModifier objects representing the attributes associated with the corresponding element in the args array. 参数的关联的属性存储在成员的签名中。A parameter's associated attributes are stored in the member's signature. 默认的联编程序不处理此参数。The default binder does not process this parameter.

culture
CultureInfo CultureInfo CultureInfo

表示要使用的全局化区域设置的 CultureInfo 对象,它对区域设置特定的转换可能是必需的,比如将数字 String 转换为 Double。The CultureInfo object representing the globalization locale to use, which may be necessary for locale-specific conversions, such as converting a numeric String to a Double.

-or- null,表示使用当前线程的 CultureInfonull to use the current thread's CultureInfo.

namedParameters
String[]

包含参数名称的数组,args 数组中的值将传递给这些参数。An array containing the names of the parameters to which the values in the args array are passed.

返回

表示被调用成员的返回值的 ObjectAn Object representing the return value of the invoked member.

注解

此方法用于访问托管类到从非托管代码,不应从托管代码调用。This method is for access to managed classes from unmanaged code, and should not be called from managed code.

Type.InvokeMember方法调用使用指定的绑定约束并匹配指定的参数列表、 修饰符和区域性的指定的成员。The Type.InvokeMember method invokes the specified member, using the specified binding constraints and matching the specified argument list, modifiers, and culture.

适用于