???????????C#????????????胁??????????????????????????????????????????些???????????
?????.C?????械????????
????????????????校???????????????睢�??谓?????????????????????????-.-???????????????????????square??cube??????????????????????????????????搴�?????calcu?????????calcu???square?????????calcu??????????square??????????????????????????????????????????锟�???????????????????????

1 #include <stdio.h>
2
3 void square(int x) { printf("square of %d is %d
"??x??x*x); }
4 void cube(int x) { printf("cube of %d is %d
"??x??x*x*x); }
5
6 int main()
7 {
8     void (*calcu)(int x);
9     calcu=square;
10     calcu(2);
11
12     return 0;
13 }

??????.C#????械????
??????????????????????C#奴??????????????C#?????????????????????????????????????????搴�?????????????????效???????????????????????谓??????????????C?械??????????????????????????

1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Threading.Tasks;
6
7 namespace Delegate
8 {
9     class Program
10     {
11         static void square(int x) { Console.WriteLine("square of {0} is {1}"?? x?? x * x); }
12         static void cube(int x) { Console.WriteLine("cube of {0} is {1}"?? x?? x * x * x); }
13
14         delegate void math(int x); //???????????
15
16         static void Main(string[] args)
17         {
18             math calcu;
19             calcu += square;
20             calcu(2);
21             Console.ReadKey();
22         }
23     }
24 }

????????????????????????math??????????????void*????????????????????????calcu???????????????????????????搴�????????????????static????????煤??????未?????????芯???????????????????????
??????.??械???梅???
??????????????????19?泻????????写??? calcu+=cube; ???谢????square??cube???????谩?????????????? += ?????????????斜??????????? -= ??????????????????calcu??void **????????????????????椋�?????械????????????????????蔚???calcu????????????椋�?????蔚???????????????