c# - get end values from lambda expressions method parameters -
basically want values of parameters of called method this: var x = 1; var = 2; var b = 3; do<homecontroller>(o => o.save(x, "jimmy", a+b+5, math.sqrt(81))); public static void do<t>(expression<action<t>> expression) t : controller { // values 1,jimmy,10,9 here } well, you'd need drill expression, find methodcallexpression , , @ arguments it. note don't have value of o , we've got assume arguments method don't rely on that. we're still assuming lambda expression relies on being methodcallexpression ? edit: okay, here's edited version evaluates arguments. however, assumes you're not using lambda expression parameter within arguments (which new object[1] - it's providing null parameter, effectively). using system; using system.linq.expressions; class foo { public void save(int x, string y, int z, double d) { } } class program { static void main() { var x = 1; ...