Creates a Delegate of the specified type to represent the specified static method.
[Visual Basic] Overloads Public Shared Function CreateDelegate( _ ByVal type As Type, _ ByVal method As MethodInfo _ ) As Delegate [C#] public static Delegate CreateDelegate( Type type, MethodInfo method ); [C++] public: static Delegate* CreateDelegate( Type* type, MethodInfo* method ); [JScript] public static function CreateDelegate( type : Type, method : MethodInfo ) : Delegate;
A Delegate of the specified type to represent the specified static method.
Exception Type | Condition |
---|---|
ArgumentNullException | type is a null reference (in Visual Basic Nothing).
-or- method is a null reference (Nothing). |
ArgumentException | type does not inherit from either Delegate or MulticastDelegate.
-or- method is not a static method. |
ExecutionEngineException | type does not have an Invoke method. |
AccessException | The caller does not have access to the method represented by the Delegate; for instance, if the method is private. (?) |
SecurityException | method is outside the current assembly and the caller does not have ReflectionPermission for the assembly containing method.
(?) |
This method creates delegates for static methods only. A static method is a method that is associated with the class itself.
type must inherit from either Delegate or MulticastDelegate.
Delegate Class | Delegate Members | System Namespace | Delegate.CreateDelegate Overload List | MulticastDelegate | ReflectionPermission | MethodInfo