Code: Select all
public Func Get(Object obj, Action action = null)
{
Expression lambda = GetLambdaExpression(obj);
var parameterValue = action.Method.GetParameters().Single();
var callback = Expression.Call(Expression.Constant(action.Target), action.Method, Expression.Constant(parameterValue));
return lambda.Compile();
}
Code: Select all
obj => { action(obj); return lambda(obj); }
Mobile version