Delegate.CreateDelegate Method (Type, Object, String)
Creates a delegate of the specified type that represents the specified instance method to invoke on the specified class instance.
Assembly: mscorlib (in mscorlib.dll)
- Type: System.Type
The type of delegate to create.
- Type: System.Object
The class instance on which method is invoked.
- Type: System.String
The name of the instance method that the delegate is to represent.
Return ValueType: System.Delegate
A delegate of the specified type that represents the specified instance method to invoke on the specified class instance.
type is null.
target is null.
method is null.
type does not inherit MulticastDelegate.
type is not a RuntimeType. See Runtime Types in Reflection.
method is not an instance method.
method cannot be bound; for example, because it cannot be found.
The Invoke method of type is not found.
The caller does not have access to method.
Application code attempts to access this member late-bound, for example, by using the Type.InvokeMember method.
This method creates delegates for instance methods only. An instance method is a method that is associated with an instance of a class; a static method is a method that is associated with the class itself.
In Silverlight, method must specify an accessible method.
This method overload is equivalent to calling the CreateDelegate(Type, Object, String, Boolean, Boolean) method overload, and specifying false for ignoreCase and true for throwOnBindFailure.
Silverlight for Windows PhoneCreateDelegate throws MissingMethodException when attempting to create a delegate with incorrect arguments. Delegate.CreateDelegate throws TargetInvocationException when called on a null object. Delegate.CreateDelegate throws MissingMethodException instead of ArgumentException for non-instance methods.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.