c# - Need help in terminating deferred execution -


The following snippet prints 1 to 10 on the console, but unless the variable 'i' reaches int.maxValue Does not end. To mention what I'm missing for TAI.

  class programs {public stable IEnumerable & lt; Int & gt; GetList () {int i = 0; While (i & lt; int.MaxValue) {i ++; Returns I; }} Fixed zero main (string [] args) {var q = from I getList () // keeps calling until I reach int.MaxValue where I < Select = 10; Foreach (q in q) console. Limit (i); }}  

You can try:

  Var Q = GetList () Take while ((I) => I  

Comments