
public abstract object
InvokeMember(string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters);
When overridden in a derived class, invokes the specified member, using the specified binding constraints and matching the specified argument list, modifiers and culture.
Полное описание ...
Parameters:
name:
The string containing the name of the constructor, method, property, or field
member to invoke.-or- An empty string ("") to invoke the default member.
-or-For IDispatch members, a string representing the DispID, for example
"[DispID=3]".
invokeAttr:
A bitmask comprised of one or more System.Reflection.BindingFlags that specify
how the search is conducted. The access can be one of the BindingFlags such
as Public, NonPublic, Private, InvokeMethod, GetField, and so on. The type
of lookup need not be specified. If the type of lookup is omitted, BindingFlags.Public
| BindingFlags.Instance | BindingFlags.Static are used.
binder:
An object that defines a set of properties and enables binding, which can
involve selection of an overloaded method, coercion of argument types, and
invocation of a member through reflection.-or- A null reference (Nothing
in Visual Basic), to use the System.Type.DefaultBinder. Note that explicitly
defining a System.Reflection.Binder object may be required for successfully
invoking method overloads with variable arguments.
target:
The object on which to invoke the specified member.
args:
An array containing the arguments to pass to the member to invoke.
modifiers:
An array of System.Reflection.ParameterModifier objects representing the
attributes associated with the corresponding element in the args array. A
parameter's associated attributes are stored in the member's signature. The
default binder processes this parameter only when calling a COM component.
culture:
The System.Globalization.CultureInfo object representing the globalization
locale to use, which may be necessary for locale-specific conversions, such
as converting a numeric String to a Double.-or- A null reference (Nothing
in Visual Basic) to use the current thread's System.Globalization.CultureInfo.
named
Parameters:
An array containing the names of the parameters to which the values in the
args array are passed.
Exceptions:
An object representing the return value of the invoked member.
Exceptions:
System.ArgumentNullException:
invokeAttr does not contain CreateInstance and name is null.
System.ArgumentException:
args and modifiers do not have the same length.-or- invokeAttr is not a valid
System.Reflection.BindingFlags attribute.-or- invokeAttr does not contain
one of the following binding flags: InvokeMethod, CreateInstance, GetField,
SetField, GetProperty, or SetProperty.-or- invokeAttr contains CreateInstance
combined with InvokeMethod, GetField, SetField, GetProperty, or SetProperty.-or-
invokeAttr contains both GetField and SetField.-or- invokeAttr contains both
GetProperty and SetProperty.-or- invokeAttr contains InvokeMethod combined
with SetField or SetProperty.-or- invokeAttr contains SetField and args has
more than one element.-or- The named parameter array is larger than the argument
array.-or- This method is called on a COM object and one of the following
binding flags was not passed in: BindingFlags.InvokeMethod, BindingFlags.GetProperty,
BindingFlags.SetProperty, BindingFlags.PutDispProperty, or BindingFlags.PutRefDispProperty.-or-
One of the named parameter arrays contains a string that is null.
System.MethodAccessException:
The specified member is a class initializer.
System.MissingFieldException:
The field or property cannot be found.
System.MissingMethodException:
No method can be found that matches the arguments in args.-or- No member
can be found that has the argument names supplied in namedParameters.-or-
The current System.Type object represents a type that contains open type
parameters, that is, System.Type.ContainsGenericParameters returns true.
System.Reflection.TargetException:
The specified member cannot be invoked on target.
System.Reflection.AmbiguousMatchException:
More than one method matches the binding criteria.
System.InvalidOperationException:
The method represented by name has one or more unspecified generic type parameters.
That is, the method's System.Reflection.MethodInfo.ContainsGenericParameters
property returns true.