In IronPython, I am trying to call a PythonFunction with a different number of arguments from C #. For instance,
I want to do:
def foo(a, b):
print a, b
def bar(a, b, c = None):
print a, b, c
p = App.DynamicEvent()
p.addHandler(foo)
p.addHandler(bar)
p.invoke("Not", "Working")
where it addHandlertakes one argument and somehow saves it in the list of methods that need to be called, and invokehas the following signature:
public virtual void invoke(params object[] tArgs)
Since I want to avoid specifics for PythonEngine(and therefore engine.Operations.Invoke()), I tried several ways to store and implement these things as delegates, but I think that the essence of my problem is that I donβt know how to save a base type MulticastDelegatecompatible with PythonFunction?
Perhaps I want to implement my own method DynamicInvoke? Any thoughts and experience will be very grateful!
, , Javascript, IronPython #. Javascript: Client.doThing("something", 4, {"key:"value"})
python :
def doThing(s, i, d):
pass
:
doThingEvent = App.DynamicEvent()
doThingEvent.addHandler(doThing)
WebBrowser.handleMethod("doThing", doThingEvent);