Hello to all

Can you help me with this. I'm trying to extend my application with IronPython. 
I have class that I want to assign delegate from IronPython script. Here is an 
example:
public class T
{
        public int I { get; set; }
        public delegate void FunDelegate();
        public FunDelegate Fun;
}

And then I'm trying to assign Python function to my delegate(ScriptRunner is 
just a wrapper for calling IP code)
            T test = new T();
            Console.WriteLine(test.I);
            ScriptRunner.RunCode(@"def Fun():
    I = 10

Obj.Fun= Fun", ref test);

And this code fails with exception 
Object of type 'IronPython.Runtime.PythonFunction' cannot be converted to type 
'testesting.T+FunDelegate'.

Is there any way to avoid this? Or there is a better way

Thanks for help
Pawel


_________________________________________________________________
Funkcja Co Nowego wyświetla informacje w czasie rzeczywistym. Pokaż mi jak.
http://home.live.com/
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to