共用方式為


TypeBuilder.InvokeMember Method (String, BindingFlags, Binder, Object, array<Object[], array<ParameterModifier[], CultureInfo, array<String[])

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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.

Namespace:  System.Reflection.Emit
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Overrides 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
public override Object InvokeMember(
    string name,
    BindingFlags invokeAttr,
    Binder binder,
    Object target,
    Object[] args,
    ParameterModifier[] modifiers,
    CultureInfo culture,
    string[] namedParameters
)

Parameters

  • name
    Type: System.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.
  • binder
    Type: System.Reflection.Binder
    An object that enables the binding, coercion of argument types, invocation of members, and retrieval of MemberInfo objects using reflection. If binder is nulla null reference (Nothing in Visual Basic), the default binder is used. See Binder.
  • target
    Type: System.Object
    The object on which to invoke the specified member. If the member is static, this parameter is ignored.
  • args
    Type: array<System.Object[]
    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. If there are no parameters this should be null.
  • modifiers
    Type: array<System.Reflection.ParameterModifier[]
    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 more details.
  • culture
    Type: System.Globalization.CultureInfo
    An instance of CultureInfo used to govern the coercion of types. If this is null, the CultureInfo for the current thread is used. (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
    Type: array<System.String[]
    Each parameter in the namedParameters array gets the value in the corresponding element in the args array. If the length of args is greater than the length of namedParameters, the remaining argument values are passed in order.

Return Value

Type: System.Object
The return value of the invoked member.

Implements

IReflect.InvokeMember(String, BindingFlags, Binder, Object, array<Object[], array<ParameterModifier[], CultureInfo, array<String[])

Exceptions

Exception Condition
NotSupportedException

This method is not currently supported for incomplete types.

Remarks

This method is not currently supported. You can This method is not supported for incomplete types. Get the completed type by calling CreateType, and use reflection on the completed type.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.