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


调用指定的成员。Invokes the specified member. 在指定的活页夹和调用属性的约束下,要调用的方法必须为可访问,并且提供与指定的自变量列表最具体的匹配。The method that is to be invoked must be accessible and provide the most specific match with the specified argument list, under the constraints of the specified binder and invocation attributes.

 override 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 override 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);
override this.InvokeMember : string * System.Reflection.BindingFlags * System.Reflection.Binder * obj * obj[] * System.Reflection.ParameterModifier[] * System.Globalization.CultureInfo * string[] -> obj


String String String

要调用的成员的名称。The name of the member to invoke. 这可以是构造函数、方法、属性或字段。This can be a constructor, method, property, or field. 必须指定合适的调用属性。A suitable invocation attribute must be specified. 请注意,可以通过将一个空字符串作为成员的名称进行传递来调用一个类的默认成员。Note that it is possible to invoke the default member of a class by passing an empty string as the name of the member.

BindingFlags BindingFlags BindingFlags

调用属性。The invocation attribute. 这必须是来自 BindingFlags 的位标志。This must be a bit flag from BindingFlags.

Binder Binder Binder

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

Object Object Object

对其调用指定成员的对象。The object on which to invoke the specified member. 如果该成员为静态,则忽略此参数。If the member is static, this parameter is ignored.


自变量列表。An argument list. 这是一个对象数组,包含要调用的成员的参数的数目、顺序和类型。This is an array of objects that contains the number, order, and type of the parameters of the member to be invoked. 如果不存在任何参数,则这应为 null。If there are no parameters this should be null.


args 长度相同的数组,其元素表示与要调用的成员的自变量关联的特性。An array of the same length as args with elements that represent the attributes associated with the arguments of the member to be invoked. 参数在元数据中具有与之相关联的属性。A parameter has attributes associated with it in the metadata. 它们由不同的互操作性服务使用。They are used by various interoperability services. 有关这些说明的详细信息,请参见元数据规范。See the metadata specs for details such as this.

CultureInfo CultureInfo CultureInfo

用于控制类型强制的 CultureInfo 的实例。An instance of CultureInfo used to govern the coercion of types. 如果这是 NULL,则使用当前线程的 CultureInfoIf this is null, the CultureInfo for the current thread is used. (注意,这对于某些转换是必要的,例如,将表示 1000 的 String 转换为 Double 值,因为不同区域性的 1000 表示形式不同。)(Note that this is necessary to, for example, convert a string that represents 1000 to a double value, since 1000 is represented differently by different cultures.)


namedParameters 数组中的每个参数对应 args 数组中的元素来获取值。Each parameter in the namedParameters array gets the value in the corresponding element in the args array. 如果 args 的长度大于 namedParameters 的长度,则剩余的自变量值将按顺序传递。If the length of args is greater than the length of namedParameters, the remaining argument values are passed in order.


返回被调用的成员的返回值。Returns the return value of the invoked member.


在不完整类型中目前不支持此方法。This method is not currently supported in types that are not complete.


您可以使用Type.GetTypeAssembly.GetType检索该类型,并在检索到的类型上使用反射。You can retrieve the type using Type.GetType or Assembly.GetType and use reflection on the retrieved type.