I had something working using IronPython.Runtime.OldClass and IronPython.Runtime.OldInstance, but I don't even understand what i've done...

First, my IP script "ClassIP.py", defining a small class :
class MyClass:
    def __init__ (self, text):
        self.text = text

    def test(self):
        return "Test " + self.text
And then a form with one TextBox in C# :

        public Form1()
        {
            InitializeComponent();

            new ClassIP().Initialize();
           
            IronPython.Runtime.OldInstance current = (IronPython.Runtime.OldInstance)
                ((IronPython.Runtime.OldClass)ClassIP.MyClass).Call("from C# !");

            IronPython.Runtime.Method currentTest = (IronPython.Runtime.Method)current.__class__.__dict__["test"];

            textBox1.Text = (string) currentTest.Call(current);
        }

Is this something meaningful for you ?

Frédéric Cadier

Sanghyeon Seo a écrit :
2006/7/12, Frédéric Cadier <[EMAIL PROTECTED]>:
  
I hope I won't be too annoying with a newbie question... but I'm
wondering how to run IP code from C# : I would for example define a
class MyClass in myclass.py, and want to instanciate it from some C# code.
    

I believe this (defining CLS type in IronPython) is currently not
possible, and it isn't planned for 1.0. That doesn't mean it won't be
possible forever though.

Seo Sanghyeon
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



  
_______________________________________________
users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to