我可以轻松地构建任何linq表达式而无需使用Expression工厂方法.例如:
Func<int, string> f = i =>
{
var result = i.ToString();
//... rest of the code
return result;
};
Expression<Func<string>> f2 = () => f(123);
var s = f2.Compile()();
Run Code Online (Sandbox Code Playgroud)
通过调用工厂方法手动构建表达式有什么好处?
例子:
"(a.b + c) * 7"| 归档时间: |
|
| 查看次数: |
174 次 |
| 最近记录: |