Mono Class Library: System.Delegate Overview | Members

System.Delegate.CreateDelegate Method

Returns a new delegate with the specified static method as its invocation list.

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

Parameters

type
The Type of delegate to return. This Type is required to derive from Delegate .
target
A Type representing the class that implements method .
method
A string containing the name of the static method implemented by target .

Returns

A Delegate of type type that invokes method.

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 a static 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 static methods. To create a delegate that invokes instance methods, see Delegate.CreateDelegate(Type, object, string)(Type, object, string).

Requirements

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