/ Published in: C#

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var valueFromSomewhere = "BAR"; Expression<Func<Controller, string, object>> expressionWithArg = (c, s) => c.Action("foo", s); var methodCallExpression = (MethodCallExpression)expressionWithArg.Body; var expressionWithoutArg = Expression.Lambda<Func<Controller, object>>( Expression.Call(methodCallExpression.Object, methodCallExpression.Method, methodCallExpression.Arguments[0], Expression.Constant(valueFromSomewhere)), expressionWithArg.Parameters[0] );
Comments
