2010-05-19 Jb Evain <jbevain@novell.com>
[mcs.git] / tests / gtest-107.cs
blobdaa454c8f68b2e7fb6a9aac1ab4def68bfaf9af2
1 using System;
3 public delegate V Mapper<T,V> (T item);
5 public interface ITree<T>
7 void Map<V> (Mapper<T,V> mapper);
10 public class Tree<T> : ITree<T>
12 T item;
14 public Tree (T item)
16 this.item = item;
19 public void Map<V> (Mapper<T,V> mapper)
21 V new_item = mapper (item);
25 class X
27 private string themap (int i)
29 return String.Format ("AA {0,4} BB", i);
32 void Test ()
34 Tree<int> tree = new Tree<int> (3);
35 tree.Map (new Mapper<int,string> (themap));
38 static void Main ()
40 X x = new X ();
41 x.Test ();