AccessibleObject.IReflect.InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]) 方法

定义

 virtual System::Object ^ System.Reflection.IReflect.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) = System::Reflection::IReflect::InvokeMember;
object IReflect.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);

参数

name
String

要查找的成员的名称。The name of the member to find.

invokeAttr
BindingFlags

BindingFlags 调用特性之一。One of the BindingFlags invocation attributes.

binder
Binder

BindingFlags 位标志之一。One of the BindingFlags bit flags. 实现 Binder,它包含与此方法相关的属性。Implements Binder, containing properties related to this method.

target
Object

对其调用指定成员的对象。The object on which to invoke the specified member. 对于静态成员,此参数被忽略。This parameter is ignored for static members.

args
Object[]

包含要调用的成员的参数数目、顺序和类型的对象数组。An array of objects that contains the number, order, and type of the parameters of the member to be invoked. 如果没有参数,则这是一个空数组。This is an empty array if there are no parameters.

modifiers
ParameterModifier[]

一个 ParameterModifier 对象数组。An array of ParameterModifier objects.

culture
CultureInfo

用于控制类型强制的 CultureInfo 的实例。An instance of CultureInfo used to govern the coercion of types.

namedParameters
String[]

参数的字符串数组。A String array of parameters.

返回

指定的成员。The specified member.

实现

异常

invokeAttrCreateInstance 并且还设置了另一个位标志。invokeAttr is CreateInstance and another bit flag is also set.

-或- invokeAttr 不是 CreateInstance,且 name 为 null-or- invokeAttr is not CreateInstance and name is null.

- 或 --or-

invokeAttr 不是来自 BindingFlags 的调用属性。invokeAttr is not an invocation attribute from BindingFlags.

-or-

invokeAttr 为属性或字段同时指定 get 和 set。invokeAttr specifies both get and set for a property or field.

-or-

invokeAttr 同时指定字段集和 Invoke 方法。提供 argsinvokeAttr specifies both a field set and an Invoke method.args 用于字段 get 操作。is provided for a field get operation.

- 或 --or-

为字段 set 操作指定了多个参数。More than one argument is specified for a field set operation.

找不到此字段或属性。The field or property cannot be found.

找不到此方法。The method cannot be found.

在没有所需 ReflectionPermission 的情况下调用私有成员。A private member is invoked without the necessary ReflectionPermission.

注解

invokeAttr 参数可以是构造函数、方法、属性或字段。The invokeAttr parameter may be a constructor, method, property, or field. 必须指定合适的调用属性。A suitable invocation attribute must be specified. 通过将空字符串 ("") 作为成员的名称传递来调用类的默认成员。Invoke the default member of a class by passing the empty string ("") as the name of the member.

@No__t 参数的长度与 args 参数相同,后者表示元数据中被调用成员的参数特性。The modifiers parameter has the same length as the args parameter, representing the invoked member's argument attributes in the metadata. 参数可以具有以下属性: pdIn、pdOut、pdRetval、pdOptional 和 pdHasDefault。A parameter can have the following attributes: pdIn, pdOut, pdRetval, pdOptional, and pdHasDefault. 这些属性分别表示 [In]、[Out]、[retval]、[optional] 和默认参数。These represent [In], [Out], [retval], [optional], and a default parameter, respectively.

此成员是显式接口成员的实现。This member is an explicit interface member implementation. 它只能在 AccessibleObject 实例被强制转换为 IReflect 接口时使用。It can be used only when the AccessibleObject instance is cast to an IReflect interface.

适用于