简单实例
1 public class test
2 {
3 public deledate void MenuHandler(string username);
4 public void MenuHandlershixian(string username)
5 {
6 response.write(username);
7 }
8 public void show()
9 {
10 MenuHandler mh=MenuHandlershixian;
11 mh("majuan");
12 }
13 public static void main()
14 {
15 show();
16 }
17
18 }
2 {
3 public deledate void MenuHandler(string username);
4 public void MenuHandlershixian(string username)
5 {
6 response.write(username);
7 }
8 public void show()
9 {
10 MenuHandler mh=MenuHandlershixian;
11 mh("majuan");
12 }
13 public static void main()
14 {
15 show();
16 }
17
18 }
MenuHandler mh=new MenuHandler(this.MenuHandlershixian);
和
MenuHandler mh=this.MenuHandlershixian;
作用是一样的 都是获得此方法的委托实例