c# - Using a lambda expression to specify parameter of method -


given methodinfo of method how can use lambda expression specify parameter (parameterinfo)?

for example, given following method signature:

public string dosomething(int id, int count); 

i have method:

withparameter(methodinfo info, expression<???> expression); 

which invoked so:

withparameter(dosomethingmethodinfo, x => x.id)  

is possible?

if want specify parameter name in statically safe way, not possible.
2 reasons:

  1. c# not support parameters
  2. methodinfo had lost static type information

alternative approaches different depending on final goal.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -