Delegate.DynamicInvoke(Object[]) 方法

定义

动态调用(后期绑定)由当前委托所表示的方法。Dynamically invokes (late-bound) the method represented by the current delegate.

public:
 System::Object ^ DynamicInvoke(cli::array <System::Object ^> ^ args);
public object DynamicInvoke (object[] args);
member this.DynamicInvoke : obj[] -> obj
Public Function DynamicInvoke (args As Object()) As Object

参数

args
Object[]

作为参数传递给当前委托所表示的方法的对象数组。An array of objects that are the arguments to pass to the method represented by the current delegate.

- 或 --or- 如果当前委托所表示的方法不需要参数,则为 nullnull, if the method represented by the current delegate does not require arguments.

返回

委托所表示的方法返回的对象。The object returned by the method represented by the delegate.

异常

调用方不能访问由委托表示的方法(例如,在方法为私有方法的情况下)。The caller does not have access to the method represented by the delegate (for example, if the method is private).

-or- args 中列出的参数的数目、顺序或类型无效。The number, order, or type of parameters listed in args is invalid.

对对象或类调用委托所表示的方法,但该对象或类不支持这种方法。The method represented by the delegate is invoked on an object or a class that does not support it.

委托所表示的方法是实例方法,目标对象为 nullThe method represented by the delegate is an instance method and the target object is null.

-or- 封装的方法之一引发异常。One of the encapsulated methods throws an exception.

注解

此方法调用 DynamicInvokeImpl 方法。This method calls the DynamicInvokeImpl method.

安全性

ReflectionPermission
当通过诸如InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[])等机制后期绑定调用时。when invoked late-bound through mechanisms such as InvokeMember(String, BindingFlags, Binder, Object, Object[], ParameterModifier[], CultureInfo, String[]). 关联的枚举:MemberAccessAssociated enumeration: MemberAccess

适用于

另请参阅