summaryrefslogtreecommitdiff
path: root/mcs/tests/gtest-iter-30.cs
blob: 192c82be79d7d8a46062c07e01f1000e7edd378b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Collections.Generic;

public class Program
{
	public static void Main ()
	{
		foreach (var x in new M ().Test ()) {
			Console.WriteLine (x);
		}
	}
}

class M
{
	public IEnumerable<int> Test ()
	{
		Action a = delegate {
			int k = 0;
			Action x = delegate {
				Console.WriteLine (this);
				Console.WriteLine (k);
			};

			x ();
			Console.WriteLine (this);
		};

		a ();
		
		yield return 1;
	}
}