c#入门到精通
霜叶红似二月花
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C#从入门到精通19 委托(一) 概念介绍
一、定义 委托(delegate)是C#语言的一种指针,是函数指针的升级版。 C语言语法中函数指针定义及使用样例 #include <stdio.h> //c语言中的函数指针类型定义 typedef int(*Calc)(int a, int b); int Add(int a, int b){return a + b;} int Sub(int a, int b){ret...原创 2019-05-26 19:37:41 · 225 阅读 · 0 评论 -
C#从入门到精通19 委托(二) 模板和回调
使用1:模板方法,借用指定的外部方法来产生结果 1)相当于填空题 2)常位于代码中部 3)委托有返回值 WrapFactory包装工厂类里面的WrapProduct这个方法,这里这个委托的调用是可以修改的。传进来的委托,它封装了什么方法,在这里就可以得到这个方法产出的产品。好处在于,一旦写成这样以后,我们的Product类,Box类,以及WrapFactory类都不用再动了。我们这里只需要不断扩...原创 2019-05-26 22:04:19 · 515 阅读 · 0 评论 -
C#从入门到精通19 委托(三) 委托的高级使用 多播委托
using System; using System.Threading; namespace DelegateExample { class Program { static void Main() { Student stu1 = new Student() { ID = 1, PenColor = Consol...原创 2019-05-26 22:45:38 · 184 阅读 · 0 评论 -
C#从入门到精通19 委托(四) 委托的高级使用 隐式异步调用
using System; using System.Threading; using System.Threading.Tasks; namespace DelegateExample { class Program { static void Main() { Student stu1 = new Student() ...原创 2019-05-26 23:14:38 · 371 阅读 · 0 评论 -
C#从入门到精通20 (一)接口隔离
using System; namespace 接口隔离 { class Program { static void Main(string[] args) { var driver = new Driver(new Car()); driver.Drive(); ...原创 2019-05-29 21:09:26 · 181 阅读 · 0 评论
分享