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, MethodInfo)

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;

Parameters

type
The Type of Delegate to create.
method
The MethodInfo describing the method for which the Delegate is to be created.

Return Value

A Delegate of the specified type to represent the specified static method.

Exceptions

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.

(?)

Remarks

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.

See Also

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