2006-09-14 Jonathan Chambers <joncham@gmail.com>
[mcs.git] / tests / test-iter-02.cs
blobb32c30b4e65565e87d39a7c959f180911515b450
1 // Compiler options: -langversion:default
3 using System;
4 using System.Collections;
6 class X {
7 static int start, end;
8 static int i;
10 static IEnumerator GetRange ()
12 yield return 1;
13 for (i = start; i < end; i++)
14 yield return i;
15 yield return 100;
18 static int Main ()
20 start = 10;
21 end = 30;
23 int total = 0;
25 IEnumerator e = GetRange ();
26 while (e.MoveNext ()){
27 Console.WriteLine ("Value=" + e.Current);
28 total += (int) e.Current;
31 if (total != 491)
32 return 1;
33 return 0;