Merge pull request #487 from mayerwin/patch-1
[mono.git] / mcs / tests / test-iter-21.cs
1 using System;
2 using System.Collections;
3  
4 class X {
5         delegate void A ();
6  
7         static IEnumerable GetIt (int [] args)
8         {
9                 foreach (int arg in args) {
10                         Console.WriteLine ("OUT: {0}", arg);
11                         A a = delegate {
12                                 Console.WriteLine ("arg: {0}", arg);
13                                 return;
14                         };
15                         a ();
16                         yield return arg;
17                 }
18         }
19  
20         public static int Main ()
21         {
22                 int total = 0;
23                 foreach (int i in GetIt (new int [] { 1, 2, 3})){
24                         Console.WriteLine ("Got: " + i);
25                         total += i;
26                 }
27  
28                 if (total != 6)
29                         return 1;
30  
31                 return 0;
32         }
33 }