委托Delegate
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace deledate
6{
7 delegate string Getstr(string str,float money);
8
9 class 你
10
{
11 static void Main(string[] args)
12
{ //你给我15块调用我去买香烟
13 Console .WriteLine(我.买东西("香烟",15));
14 }
15 }
16
17 class 我
18
{ //我不会买,又委托他去买
19 public static Getstr 买东西 = 他.买东西;
20 }
21
22 class 他
23
{ //他拿到钱取买叫他买的东西
24 public static string 买东西(string str,float money)
25
{
26 return str;
27 }
28 }
29}
转载于:https://www.cnblogs.com/eduask0114/archive/2009/03/11/1409030.html