I have a expression of this type:
Expression<Action<T>> expression
how do I get the parameters names from this expression (optional: and values) ?
example:
o => o.Method("value1", 2, new Object());
names could be str_par1, int_par2, obj_par3
Expression<Action<Thing>> exp = o => o.Method(1, 2, 3);
var methodInfo = ((MethodCallExpression)exp.Body).Method;
var names = methodInfo.GetParameters().Select(pi => pi.Name);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With