Call methods using names in C#

Viewed 44410

I have a number of 'jobs' in my application, where each job has a list of methods which it needs to call, along with it's parameters. Essentially a list containing the following object is called:

string Name;
List<object> Parameters;

So basically, when a job runs I want to enumerate through this list, and call the relevant methods. For example, if I have a method like the following:

TestMethod(string param1, int param2)

My method object would be like this:

Name = TestMethod
Parameters = "astring", 3

Is it possible to do this? I imagine reflection will be the key here.

5 Answers
Related