基本上,我有一个类,我们称之为'Controller',它将MethodInfo作为构造函数参数。因此,创建此MethodInfo的类称为“描述符”。问题是,当'Controller'调用MethodInfo时,它总是失败:
//MethodInfo creation on Descriptor
var mx = new Func<string>(() => "foo").Method;
//Error caused when Controller runs it
ArgumentException: Method '..anonymous...' declared on type 'Descriptor' cannot be called with instance of type 'Controller'
System.Linq.Expressions.Expression.ValidateCallInstanceType(Type instanceType, MethodInfo method)
“控制器”课程完全不受限制。你们有什么建议吗?