【发布时间】:2011-05-23 12:36:49
【问题描述】:
我使用这段代码使用 IronPython 执行 python 表达式。
ScriptEngine engine = Python.CreateEngine();
ScriptScope scope = engine.CreateScope();
scope.SetVariable("m", mobject);
string code = "m.ID > 5 and m.ID < 10";
ScriptSource source =
engine.CreateScriptSourceFromString(code, SourceCodeKind.Expression);
source.Execute(scope);
有没有办法将生成的表达式树作为 c# 对象,例如BlockExpression
?
【问题讨论】:
-
你在哪里传递代码?
-
我参考了 Microsoft Scripting 库和 IronPython。我正在使用 .net 4.0
标签: linq ironpython expression-trees