Creates a Delegate of the specified type to represent the specified instance method of the specified Type instance.
[Visual Basic] Overloads Public Shared Function CreateDelegate( _ ByVal type As Type, _ ByVal target As Type, _ ByVal method As String _ ) As Delegate [C#] public static Delegate CreateDelegate( Type type, Type target, string method ); [C++] public: static Delegate* CreateDelegate( Type* type, Type* target, String* method ); [JScript] public static function CreateDelegate( type : Type, target : Type, method : String ) : Delegate;
A Delegate of the specified type to represent the specified instance method of the specified Type 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.
For example, passing "System.Threading.ThreadStart" to the Type.GetType method will return a Type object for the ThreadStart delegate.
Delegate Class | Delegate Members | System Namespace | Delegate.CreateDelegate Overload List | MulticastDelegate | ReflectionPermission | Object