更新时间:2022-04-18 08:14:02
实际上,通过一些技巧和转换,您可以得到所有结果如下:
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