Share this page

# CreateDelegateFromMethod

.NET Vuser Functions

Creates a delegate of the specified type that represents a static or instance method.

    Delegate CreateDelegateFromMethod(Type delegateType, Type type, object targetObject, string name, int metadataToken);

This function returns a delegate of the specified type that represents the specified static or instance method.

delegateType | The type of delegate to create.
type | The type that contains the method.
targetObject | The object to which the delegate is bound, or a null reference to treat the method as static.
name | The name of the method.
metadataToken | The metadataToken of the method.

Note: Do not add this function manually to a script. It is generated by VuGen automatically.

## Parameterization

Parameterization is not applicable to this function.

## Example

This example shows the creating of a delegate from a method.

    value_1= ((EventHandler)(LrReplayUtils.CreateDelegateFromMethod(
               typeof(System.EventHandler), typeof(AccessModifiers.Program), null,"targetObj_InternalEvent", 100663310)));

    PublicClass.StaticPublicEvent += value_1;

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: