System.Delegate.DynamicInvoke Method

Dynamically invokes (late-bound) the method represented by the current delegate.

Syntax

public object DynamicInvoke (params object[] args)

Parameters

args
An array of objects that are the arguments to pass to the method represented by the current delegate.

Returns

The object returned by the method represented by the delegate.

Exceptions

TypeReason
ArgumentExceptionThe type of one or more elements in args is invalid as a parameter to the methods implemented by the current instance.
MethodAccessException

The caller does not have the required permissions.

-or-

The number, order or type of parameters listed in args is invalid.

System.Reflection.TargetException

A method in the invocation list of the current instance is an instance method and its target object is null.

-or-

A method in the invocation list of the current instance was invoked on a target object or a class that does not implement it.

!:System.Reflection.TargetParamterCountException The number of elements in args is not equal to the number of parameters required by the methods invoked by the current instance.
System.Reflection.TargetInvocationExceptionA method in the invocation list of the current instance threw an exception.

Remarks

This method calls the Delegate.DynamicInvokeImpl(Object[]) method.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0