* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / tests / gtest-046.cs
1 // Generic delegates.
2
3 using System;
4
5 delegate void Test<T> (T t);
6
7 class Foo<T>
8 {
9         public event Test<T> MyEvent;
10
11         public void Hello (T t)
12         {
13                 if (MyEvent != null)
14                         MyEvent (t);
15         }
16 }
17
18 class X
19 {
20         static void do_hello (string hello)
21         {
22                 Console.WriteLine ("Hello: {0}", hello);
23         }
24
25         static void Main ()
26         {
27                 Foo<string> foo = new Foo<string> ();
28                 foo.MyEvent += new Test<string> (do_hello);
29                 foo.Hello ("Boston");
30         }
31 }