LINQ Expression Conversion / Concat from Int to string

后端 未结 4 393
南方客
南方客 2020-12-19 07:33

I want to Concat two expressions for the final expression

Expression>

So I have created expression belwo code

4条回答
  •  时光说笑
    2020-12-19 08:05

    To expand on Richard Deeming's answer even though it's a little late.

    Expression.Call(
        typeof(string).GetMethod("Concat", new[] { typeof(object), typeof(object) }),
        Expression.Convert(cons, typeof(object)),
        Expression.Convert(memberExpression, typeof(object))
    );
    

    That should work just fine while allowing the signature to stay as you have it.

提交回复
热议问题