summaryrefslogtreecommitdiff
path: root/mcs/tests/gtest-107.cs
blob: b56bed969b2efe4eb8868ba65d7931df2725ccd5 (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
34
35
36
37
38
39
40
41
42
43
using System;

public delegate V Mapper<T,V> (T item);

public interface ITree<T>
{
	void Map<V> (Mapper<T,V> mapper);
}

public class Tree<T> : ITree<T>
{
	T item;

	public Tree (T item)
	{
		this.item = item;
	}

	public void Map<V> (Mapper<T,V> mapper)
	{
		V new_item = mapper (item);
	}
}

class X
{
	private string themap (int i)
	{
		return String.Format ("AA {0,4} BB", i);
	}

	void Test ()
	{
		Tree<int> tree = new Tree<int> (3);
		tree.Map (new Mapper<int,string> (themap));
	}

	public static void Main ()
	{
		X x = new X ();
		x.Test ();
	}
}