I am trying to use C# classes from python, using python.net on mono / ubuntu.
So far I managed to do a simple function call with one argument work. What I am now try
It looks like you should define your Delegate explicitly:
class MC {
// Define a delegate type
public delegate void Callback();
public double method2(Callback f) {
Console.WriteLine("Executing method2" );
/* ... do f() at some point ... */
/* also tried f.DynamicInvoke() */
Console.WriteLine("Done executing method2" );
}
}
Then from the Python code (this is a rough guess based from the docs):
def f():
print "Executing f"
# instantiate a delegate
f2 = testlib.MC.Callback(f)
# use it
mc.method2(f2)