如何從C#中使用ScriptScope.SetVariable
不使用ScriptEngine.ExecuteAndWrap("x = None", scope)
設置一個變量的值的IronPython的範圍內爲無?變量是否需要在ScriptEngine/ScriptScope中定義?這個例子沒有工作:設置的IronPython的變量無
// Note: "scope" is the ScriptScope variable assigned beforehand
scope.SetVariable("x", null);
網絡搜索發現此相關的鏈接,但它沒有提供一個解決方案:
http://lists.ironpython.com/pipermail/users-ironpython.com/2009-June/010605.html
在調用SetVariable之前,var不一定需要存在於範圍中。 – 2012-01-12 19:03:02