How to use IronPython with Visual Studio 2008

前端 未结 6 1607
囚心锁ツ
囚心锁ツ 2021-01-31 06:15

I\'ve tried using the IronPython integration extension provided by Microsoft. But it does not work with Visual Studio 2008.

Is there a proper VS 2008 IDE extension for

6条回答
  •  -上瘾入骨i
    2021-01-31 06:47

    string code = @"100 * 2 + 4 / 3";
    
    ScriptEngine engine = Python.CreateEngine();
    ScriptSource source =
      engine.CreateScriptSourceFromString(code, SourceCodeKind.Expression);
    
    int res = source.Execute();
    Console.WriteLine(res);
    

    For the complete tutorial and example code, check out the following link:

    Extending your C# application with IronPython

    http://blogs.microsoft.co.il/blogs/berniea/archive/2008/12/04/extending-your-c-application-with-ironpython.aspx

提交回复
热议问题