开发者

Convert Boolean to condition in Expression tree

Hi Experts How I Can convert this statement to Expression tree:

x=>x.Contains("bla")
开发者_如何学编程

thanks


var parameter = Expression.Parameter(typeof(string), "x");
var lambda = Expression.Lambda<Func<string, bool>>(
    Expression.Call(
        parameter,
        "Contains",
        Type.EmptyTypes,
        Expression.Constant(
            "blah"
        )
    ),
    parameter
);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜