* ResolvedReference.cs (.ctor): Set 'OriginalItemSpec' and 'ResolvedFrom',
[mcs.git] / tests / test-iter-03.cs
blob342c03fa4bc5cf8c3e393adfeb6b4897214ae246
1 // Compiler options: -langversion:default
3 //
4 // Use
6 using System;
7 using System.Collections;
9 class X {
10 static IEnumerable GetIt (int [] args)
12 foreach (int a in args)
13 yield return a;
16 static IEnumerable GetMulti (int [,] args)
18 foreach (int a in args)
19 yield return a;
22 static int Main ()
24 int total = 0;
25 foreach (int i in GetIt (new int [] { 1, 2, 3})){
26 Console.WriteLine ("Got: " + i);
27 total += i;
30 if (total != 6)
31 return 1;
33 total = 0;
34 foreach (int i in GetMulti (new int [,] { { 10, 20 }, { 30, 40}})){
35 Console.WriteLine ("Got: " + i);
36 total += i;
38 if (total != 100)
39 return 2;
41 return 0;