Delegate.CreateDelegate Method (Type, Type, String)
Creates a delegate of the specified type that represents the specified static method of the specified class.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Parameters
- type
- Type: System.Type
The type of delegate to create.
- target
- Type: System.Type
The class that implements method.
- method
- Type: System.String
The name of the static method that the delegate is to represent.
Return Value
Type: System.DelegateA delegate of the specified type that represents the specified static method of the specified class.
| Exception | Condition |
|---|---|
| ArgumentNullException | type is null. -or- target is null. -or- method is null. |
| ArgumentException | type does not inherit MulticastDelegate. -or- type is not a RuntimeType. See Runtime Types in Reflection. -or- target is not a RuntimeType. -or- target is an open generic type. That is, its ContainsGenericParameters property is true. -or- method is not a static method (Shared method in Visual Basic). -or- method cannot be bound; for example, because it cannot be found, and throwOnBindFailure is true. |
| MissingMethodException | The Invoke method of type is not found. |
| MethodAccessException | The caller does not have access to method. -or- Application code attempts to access this member late-bound, for example, by using the Type.InvokeMember method. |
This method creates delegates for static 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, Type, String, Boolean, Boolean) method overload, and specifying false for ignoreCase and true for throwOnBindFailure.
Platform Notes
Silverlight for Windows Phone
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.