LINQ Expression Conversion / Concat from Int to string

后端 未结 4 391
南方客
南方客 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 07:55

    Instead of trying to cast to string, you could try casting to object then calling ToString(), as though you were doing:

    var converted = member.ToString();
    

    As an Expression, it will look something like this:

    var convertedExpression = Expression.Call(
                         Expression.Convert(memberExpression, typeof(object)),
                         typeof(object).GetMethod("ToString"));
    

提交回复
热议问题