NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Delegate.CreateDelegate (Type, Object, String)

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;

Parameters

type
The Type of Delegate to create.
target
The target Object instance which implements method.
method
The instance method for which the Delegate is to be created.

Return Value

A Delegate of the specified type to represent the specified instance method of the specified Object instance

Exceptions

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.

(?)

Remarks

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.

See Also

Delegate Class | Delegate Members | System Namespace | Delegate.CreateDelegate Overload List | MulticastDelegate | ReflectionPermission | Object