Click or drag to resize
DelegateCreateDelegate Method (Type, MethodInfo)
Creates a delegate of the specified type to represent the specified static method.

Namespace: System
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public static Delegate CreateDelegate(
	Type type,
	MethodInfo method
)

Parameters

type
Type: SystemType
The Type of delegate to create.
method
Type: System.ReflectionMethodInfo
The MethodInfo describing the static or instance method the delegate is to represent. Only static methods are supported in the .NET Framework version 1.0 and 1.1.

Return Value

Type: Delegate
A delegate of the specified type to represent the specified static method.
Exceptions
ExceptionCondition
ArgumentNullExceptiontype is null.-or- method is null.
ArgumentExceptiontype does not inherit MulticastDelegate.-or-type is not a RuntimeType. See Runtime Types in Reflection. -or- method is not a static method, and the .NET Framework version is 1.0 or 1.1. -or-method cannot be bound.-or-method is not a RuntimeMethodInfo. See Runtime Types in Reflection.
MissingMethodExceptionThe Invoke method of type is not found.
MethodAccessExceptionThe caller does not have the permissions necessary to access method.
See Also