DotNetDelegate

Create an instance of a delegate

WTSupported in traditional Synergy on Windows

 

 

 

delegate = new DotNetDelegate(assembly, type, object, method)

Arguments

delegate

The returned delegate instance (@DotNetDelegate).

assembly

The assembly that contains this delegate type.

type

The fully-qualified type name of the delegate, which includes the type’s namespace but not its assembly name.

object

A reference to an object that owns the specified method. (Object is ^NULL if you don’t want an instance method.)

method

The name of an instance method in object’s class.

Discussion

The DotNetDelegate constructor creates an instance of a delegate, which binds a Synergy DBL instance or static method to a delegate defined in the .NET assembly.

If the .NET Framework throws an exception, a corresponding DotNetException will be thrown.

The search for type is case-sensitive. If the type cannot be found in the specified assembly or it is not public, a “Field/Type/Property/Event not found” error ($ERR_MISSFLD) occurs. If method is not the name of an instance method within object’s class, an $ERR_MISSMETH occurs.

When the delegate function is invoked, the arguments passed to it will correspond to the type definition for the delegate. The following conversions will occur:

Examples

The example below creates a System.EventHandler delegate and stores it in an instance called button_OnClick. See Sample programs for an example in the context of a complete program.

button_OnClick = new DotNetDelegate(sys, "System.EventHandler", ^NULL,
    &  "ns1.cls1.static_meth1")