[To be supplied.]
[Visual Basic] Overrides Public Function InvokeMember( _ ByVal name As String, _ ByVal invokeAttr As BindingFlags, _ ByVal binder As Binder, _ ByVal target As Object, _ ByVal args() As Object, _ ByVal modifiers() As ParameterModifier, _ ByVal culture As CultureInfo, _ ByVal namedParameters() As String _ ) As Object [C#] public override object InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters ); [C++] public: override Object* InvokeMember( String* name, BindingFlags invokeAttr, Binder* binder, Object* target, Object* args[], ParameterModifier* modifiers[], CultureInfo* culture, String* namedParameters[] ); [JScript] public override function InvokeMember( name : String, invokeAttr : BindingFlags, binder : Binder, target : Object, args : Object[], modifiers : ParameterModifier[], culture : CultureInfo, namedParameters : String[] ) : Object;
Returns the value of the invoked member.
A method will be invoked if
the number of parameters in the method declaration equals the number of arguments in the specified argument list (unless default arguments are defined on the member), and
the type of each arguments 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 upon the type of binding requested (BindingFlags.MethodInvoke, BindingFlags.GetProperties, etc.). 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 may control which set of methods are searched based upon the accessibility attribute associated with the method. The Binder.BindToMethod method is responsible for selecting the method to be invoked. The default binder selects the most specific match.
Note: Access restrictions are ignored for fully trusted code. That is, private constructors, methods, fields, and properties can be accessed and invoked via Reflection whenever the code is fully trusted.
Currently, InvokeMember performs the NGWS runtime reflection semantics for every type of object.
If the member specified by name is an array and the BindingFlags.GetField flag is set on invokeAttr, the args array specifies the elements whose values are to be returned. For example, the following call through Type object t returns the value of the first element of the string array MyArray, which is a member of the calling object:
String ret = (String) t.InvokeMember ("MyArray", BindingFlags.GetField, null, this, new Variant[]{0});
You can use InvokeMember to set one or more elements of a member array. All elements are set to the same value. The args array must be formatted as follows:
{index1, index2, ..., value}
For example, to set the first member of MyArray from the previous example, the syntax is as follows:
t.InvokeMember ("MyArray", BindingFlags.SetField, null, this, new Variant[]{0,"Updated"});
TypeDelegator Class | TypeDelegator Members | System.Reflection Namespace | CultureInfo