Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

44 lines
558 B
C#

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 ();
}
}