I would like to call a method based on a string. It works fine using MethodInfo.Invoke().

What I would like to know if there is a way to add parameters to the call, based on the same string, e.g. instead of calling foo() I would like to call foo(1, true, "bar").

I suppose I'd have to extract the parameters, convert them to their correct primitive type and invoke the method using methodInfo.Invoke(classInstance, params).

It feels like a long shot, but is there an "OK" way of solving this?

Related posts

Recent Viewed