[IronPython] Running IronPython code from C#

Eyvind Axelsen eyvind.axelsen at profdoc.no
Wed Jul 12 14:07:08 CEST 2006


1 Add a reference to IronPython.dll in your project

2 Instantiate the python engine:

IronPython.Hosting.PythonEngine pe = new IronPython.Hosting.PythonEngine();

3 Run your code: 

string myCode = "some python code here";
pe.Execute(myCode);

HTH,

Eyvind.

-----Opprinnelig melding-----
Fra: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] På vegne av Frédéric Cadier
Sendt: 12. juli 2006 11:03
Til: users at lists.ironpython.com
Emne: [IronPython] Running IronPython code from C#

Hi everyone,

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.

Can someone help me ?

Thank you,
Frédéric Cadier
_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list