DelegateCreateDelegate Method (Type, Object, MethodInfo) |
Creates a delegate of the specified type that represents the specified static or instance method, with the specified first argument.
Namespace: SystemAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax public static Delegate CreateDelegate(
Type type,
Object firstArgument,
MethodInfo method
)
Parameters
- type
- Type: SystemType
The Type of delegate to create. - firstArgument
- Type: SystemObject
The object to which the delegate is bound, or null to treat method as static (Shared in Visual Basic). - method
- Type: System.ReflectionMethodInfo
The MethodInfo describing the static or instance method the delegate is to represent.
Return Value
Type:
DelegateA delegate of the specified type that represents the specified static or instance method.
Exceptions Exception | Condition |
---|
ArgumentNullException | type is null.-or- method is null. |
ArgumentException | type does not inherit MulticastDelegate.-or-type is not a RuntimeType. See Runtime Types in Reflection. -or-method cannot be bound.-or-method is not a RuntimeMethodInfo. See Runtime Types in Reflection. |
MissingMethodException | The Invoke method of type is not found. |
MethodAccessException | The caller does not have the permissions necessary to access method. |
See Also