C#???????????
???????????? ???????[ 2016/2/18 10:25:18 ] ????????.NET ???????????
???????????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????????????飬?????ε???????????????
??????
???·???
App??С????H5?????????????????Щ??
2024/9/11 15:34:34?????????????????????????
2024/9/10 11:13:49P-One ???????????????????????????????????????
2024/9/10 10:14:12???????????????????????????
2024/9/9 18:04:26??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44

sales@spasvo.com