Click or drag to resize
DelegateCreateDelegate Method (Type, Object, String, Boolean, Boolean)
Creates a delegate of the specified type that represents the specified instance method to invoke on the specified class instance, with the specified case-sensitivity and the specified behavior on failure to bind.

Namespace: System
Assembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntax
C#
public static Delegate CreateDelegate(
	Type type,
	Object target,
	string method,
	bool ignoreCase,
	bool throwOnBindFailure
)

Parameters

type
Type: SystemType
The Type of delegate to create.
target
Type: SystemObject
The class instance on which method is invoked.
method
Type: SystemString
The name of the instance method that the delegate is to represent.
ignoreCase
Type: SystemBoolean
A Boolean indicating whether to ignore the case when comparing the name of the method.
throwOnBindFailure
Type: SystemBoolean
true to throw an exception if method cannot be bound; otherwise, false.

Return Value

Type: Delegate
A delegate of the specified type that represents the specified instance method to invoke on the specified class instance.
Exceptions
ExceptionCondition
ArgumentNullExceptiontype is null.-or- target 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 an instance method. -or-method cannot be bound, for example because it cannot be found, and throwOnBindFailure is true.
MissingMethodExceptionThe Invoke method of type is not found.
MethodAccessExceptionThe caller does not have the permissions necessary to access method.
See Also