DotNetObject.RemoveDelegateFromEvent
Remove a delegate from an event
WSupported on Windows
|
|
|
|
object.RemoveDelegateFromEvent(eventname, delegate)
Arguments
object
One of the following:
- An object returned by the DotNetObject constructor
- A method, property, or field that returns an object
- For a static event, an assembly, returned by the DotNetAssembly constructor
eventname
The name of the event from which the delegate is removed.
delegate
A delegate returned from the DotNetDelegate constructor.
Discussion
Delegates are automatically removed from all events when they are released if the reference count of the delegate goes to zero.
Examples
The last line of the example below removes an instance of the System.EventHandler delegate named button_OnClick from the Click event. 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") button.AddDelegateToEvent("Click", button_OnClick) . . . button.RemoveDelegateFromEvent("Click", button_OnClick)