1 public delegate void Delegate(int x);
2
3 public void foo(int x)
4 {
5 System.Console.WriteLine("foo called with argument " + System.ToString(x));
6 }
7
8 public static class Alpha
9 {
10 public static void bar(int x)
11 {
12 System.Console.WriteLine("bar called with argument " + System.ToString(x));
13 }
14 }
15
16 void main()
17 {
18 Delegate dlg = foo;
19 dlg(42);
20 dlg = Alpha.bar;
21 dlg(21);
22 }