我创建了一个名为的实例input:
public class TestInput
{
public int TesTInt { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我在这个函数中使用它:
public static class TestClass
{
public static string TestFunction()
{
var testInput = new TestInput();
string res = ServicesManager.Execute<string>((object) testInput);
return res;
}
}
Run Code Online (Sandbox Code Playgroud)
该Execute功能是在这里:
public static OUT Execute<OUT>(object input)
where OUT : class
{
var method = //getting method by reflection
object[] arr = new object[] { input };
return method.Invoke(null, arr) as OUT; //Error is triggered here
}
Run Code Online (Sandbox Code Playgroud)
我调用的方法是这样的:
public …Run Code Online (Sandbox Code Playgroud)