TypeBuilder.InvokeMember Method (String, BindingFlags, Binder, Object, Object, ParameterModifier, CultureInfo, String)
Assembly: mscorlib (in mscorlib.dll)
public override Object InvokeMember ( string name, BindingFlags invokeAttr, Binder binder, Object target, Object args, ParameterModifier modifiers, CultureInfo culture, string namedParameters )
public Object InvokeMember ( String name, BindingFlags invokeAttr, Binder binder, Object target, Object args, ParameterModifier modifiers, CultureInfo culture, String namedParameters )
public override function InvokeMember ( name : String, invokeAttr : BindingFlags, binder : Binder, target : Object, args : Object, modifiers : ParameterModifier, culture : CultureInfo, namedParameters : String ) : Object
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.
The invocation attribute. This must be a bit flag from BindingFlags.
An object that enables the binding, coercion of argument types, invocation of members, and retrieval of MemberInfo objects using reflection. If binder is a null reference (Nothing in Visual Basic), the default binder is used. See Binder.
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. If there are no parameters this should be null.
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.
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.)
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 ValueReturns the return value of the invoked member.
This method is not currently supported for incomplete types.
A method will be invoked if the number of parameters in the method declaration equals the number of arguments in the specified argument list, and the type of each argument can be converted by the binder to the type of the parameter.
The binder will find all of the matching methods. These methods are found based on the type of binding requested (BindingFlags.InvokeMethod, BindingFlags.GetProperties, and so on.). The set of methods is filtered by the name, number of arguments, and a set of search modifiers defined in the binder. After the method is selected, it will be invoked. Accessibility is checked at that point. The search can control which set of methods are searched based upon the accessibility attribute associated with the method. The IBinder.BindToMethod method is responsible for selecting the method to be invoked. The default binder selects the most specific match.
Access restrictions are ignored for fully trusted code. That is, private constructors, methods, fields, and properties can be accessed and invoked using Reflection whenever the code is fully trusted.
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.