Switch to compiler-tester
[mono.git] /
1 // Compiler options: -langversion:default
2
3 using System;
4 using System.Collections;
5
6 class X {
7         static IEnumerator GetIt ()
8         {
9                 yield return 1;
10                 yield return 2;
11                 yield return 3;
12         }
13         
14         static IEnumerable GetIt2 ()
15         {
16                 yield return 1;
17                 yield return 2;
18                 yield return 3;
19         }
20
21         static int Main ()
22         {
23                 IEnumerator e = GetIt ();
24                 int total = 0;
25                 
26                 while (e.MoveNext ()){
27                         Console.WriteLine ("Value=" + e.Current);
28                         total += (int) e.Current;
29                 }
30
31                 if (total != 6)
32                         return 1;
33
34                 total = 0;
35                 foreach (int i in GetIt2 ()){
36                         Console.WriteLine ("Value=" + i);
37                         total += i;
38                 }
39                 if (total != 6)
40                         return 2;
41                 
42                 return 0;
43         }
44 }