https://startbigthinksmall.wordpress.com/2008/06/09/behind-the-scenes-of-the-c-yield-keyword/ Behind the scenes of the C# yield keywordJ ...
https://startbigthinksmall.wordpress.com/2008/06/09/behind-the-scenes-of-the-c-yield-keyword/
Behind the scenes of the C# yield keyword
June 9, 2008 by Lars Corneliussen
Each enumerator holds a state indicating:
- -2: Initialized as Enumerable. (Not yet an Enumerator)
- -1: Closed
- 0: Initialized as Enumerator.
private bool MoveNext(){ try { switch (state) { case 0: state = -1; state = 1; this.values = new int[] { 1, 2, 3, 5, 8 }; this.currentPositionInValues = 0; while (this.currentPositionInValues < this.values.Length) { current_i = this.values[this.currentPositionInValues]; current = current_i; state = 2; return true; Label_007F: state = 1; this.currentPositionInValues++; } this.Finally2(); break; case 2: goto Label_007F; } return false; } fault { this.System.IDisposable.Dispose(); }}[/sourcecode]
海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com
原标题:Behind the scenes of the C# yield keyword(转)
关键词:C#
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。