I am trying to invoke function of a class using Reflection
(assuming that object initialization as no dependency on Function to be invoked) like this
To answer the question on how to cast the result to a generic return type, the method would look something like:
public static T InvokeMethod(string assemblyName, string namespaceName, string typeName, string methodName, string stringParam)
{
// instead of String s = null;
T methodResult = default(T);
// instead of s = (String)calledType.InvokeMember(...)
methodResult = (T)calledType.InvokeMember(...);
// return s;
return methodResult;
}