Creates a Delegate of the specified type to represent the specified instance method of the specified Object instance.
[Visual Basic] Overloads Public Shared Function CreateDelegate( _ ByVal type As Type, _ ByVal target As Object, _ ByVal method As String _ ) As Delegate [C#] public static Delegate CreateDelegate( Type type, object target, string method ); [C++] public: static Delegate* CreateDelegate( Type* type, Object* target, String* method ); [JScript] public static function CreateDelegate( type : Type, target : Object, method : String ) : Delegate;
A Delegate of the specified type to represent the specified instance method of the specified Object instance
Exception Type | Condition |
---|---|
ArgumentNullException | type is a null reference (in Visual Basic Nothing).
-or- target is a null reference (Nothing). -or- method is a null reference (Nothing). |
ArgumentException | type does not inherit from either Delegate or MulticastDelegate. |
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 instance methods only. An instance method is a method that is associated with an instance of a class.
type must inherit from either Delegate or MulticastDelegate.
Delegate Class | Delegate Members | System Namespace | Delegate.CreateDelegate Overload List | MulticastDelegate | ReflectionPermission | Object