标签:
本来只是想加点东西,结果调用后发生无限递归:
public void InvokeA() { Action A = () => { Console.WriteLine("Invoked A,list deep 1 "); }; A = () => { Console.WriteLine("Invoked A,list deep 2 "); A(); }; A(); }
那么解决方法如下:
public void InvokeA() { Action A2 = () => { Console.WriteLine("Invoked A,list deep 1 "); }; Action A3 = () => { Console.WriteLine("Invoked A,list deep 2 "); A2(); }; A = A3; A(); }
标签:
原文地址:http://www.cnblogs.com/hont/p/4840718.html