I have a method, GetData(), which I would like to exchange its name dynamically based on a string parameter.
The first thing was to Get the Method out of the string parameter, MethodName.
var methodinfo = repository.GetType().GetMethod("MethodName");
Now, how to replace the GetData() method below with the dynamic value that is extracted in methodinfo?
var argumentType = repository.GetData().GetType().GetGenericArguments()[0];
I tried something like this but didn't work:
var argumentType = methodinfo.GetType().GetGenericArguments()[0];