如何使用ILGenerator.Emit (而不是LambdaExpression.Compile?)在具有未知参数的未知目标上动态创建具有未知MethodInfo调用的委托。因为我正在尝试找到一个性能更好的解决方案)
public void CreateDelegate(MethodInfo mi, object target, object[] arguments)
{
var method = new DynamicMethod("Temp", typeof(void), Type.EmptyTypes);
var generator = method.GetILGenerator();
// Make the method call mi on target with arguments
// ...
method.CreateDelegate(typeof(Action));
}https://stackoverflow.com/questions/41428927
复制相似问题