更新时间:2022-04-22 07:48:27
其实一点点诡计和强制转换,就可以得到如下所有结果:
Actually, with a little bit of trickery and casting, you can get all of the results like this:
var b = new BinaryOp(Add);
b += new BinaryOp(Multiply);
var results = b.GetInvocationList().Select(x => (int)x.DynamicInvoke(2, 3));
foreach (var result in results)
Console.WriteLine(result);
有输出:
5
6