編輯

共用方式為


AccessibleObject.IReflect.InvokeMember Method

Definition

 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);
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);
abstract member System.Reflection.IReflect.InvokeMember : string * System.Reflection.BindingFlags * System.Reflection.Binder * obj * obj[] * System.Reflection.ParameterModifier[] * System.Globalization.CultureInfo * string[] -> obj
override this.System.Reflection.IReflect.InvokeMember : string * System.Reflection.BindingFlags * System.Reflection.Binder * obj * obj[] * System.Reflection.ParameterModifier[] * System.Globalization.CultureInfo * string[] -> obj
Function InvokeMember (name As String, invokeAttr As BindingFlags, binder As Binder, target As Object, args As Object(), modifiers As ParameterModifier(), culture As CultureInfo, namedParameters As String()) As Object Implements IReflect.InvokeMember

Parameters

name
String

The name of the member to find.

invokeAttr
BindingFlags

One of the BindingFlags invocation attributes.

binder
Binder

One of the BindingFlags bit flags. 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[]

An array of ParameterModifier objects.

culture
CultureInfo

An instance of CultureInfo used to govern the coercion of types.

namedParameters
String[]

A String array of parameters.

Returns

The specified member.

Implements

Exceptions

invokeAttr is CreateInstance and another bit flag is also set.

-or- invokeAttr is not CreateInstance and name is null.

-or-

invokeAttr is not an invocation attribute from BindingFlags.

-or-

invokeAttr specifies both get and set for a property or field.

-or-

invokeAttr specifies both a field set and an Invoke method.args is provided for a field get operation.

-or-

More than one argument is specified for a field set operation.

The field or property cannot be found.

The method cannot be found.

A private member is invoked without the necessary ReflectionPermission.

Remarks

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.

The modifiers parameter has the same length as the args parameter, representing the invoked member's argument attributes in the metadata. A parameter can have the following attributes: pdIn, pdOut, pdRetval, pdOptional, and pdHasDefault. These represent [In], [Out], [retval], [optional], and a default parameter, respectively.

This member is an explicit interface member implementation. It can be used only when the AccessibleObject instance is cast to an IReflect interface.

Applies to