Mono Class Library: System.Delegate Overview | Members

System.Delegate.CreateDelegate Method

Returns a new delegate with the specified target and instance method as its invocation list.

public static Delegate CreateDelegate (Type type, object target, string method)

Parameters

type
The Type of the delegate to return. This Type is required to derive from Delegate .
target
An instance of an object that implements method .
method
A string containing the name of the instance method to be invoke on target .

Returns

A Delegate of type type that invokes method on target.

Permissions

TypeReason
System.Security.Permissions.ReflectionPermissionRequires permission to access type information. See System.Security.Permissions.ReflectionPermissionFlag.MemberAccess

Exceptions

TypeReason
ArgumentNullExceptiontype, target, or method is null.
ArgumentException

type does not derive from Delegate.

-or-

method is not an instance method.

-or-

target does not implement method.

MethodAccessExceptionThe caller does not have the required permission.

Remarks

Note: This method is used to dynamically create delegates that invoke instance methods. To create a delegate that invokes static methods, see Delegate.CreateDelegate(Type, object, string)(Type, Type, string).

Requirements

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