摘要: 一、委托的声明方式 1、delegate,例:public delegate int MethodtDelegate(int x, int y);表示有两个参数,并返回int型。2、Action,例:Action<int> action = new Action<int>(TempFunction) 阅读全文
posted @ 2020-01-16 17:59 梁仕博 阅读(220) 评论(0) 推荐(0)
摘要: 委托是C#中最为常见的内容。与类、枚举、结构、接口一样,委托也是一种类型。类是对象的抽象,而委托则可以看成是函数的抽象。一个委托代表了具有相同参数列表和返回值的所有函数。先上一段代码: public class ClassA { public delegate int CalculationDele 阅读全文
posted @ 2020-01-16 17:14 梁仕博 阅读(115) 评论(0) 推荐(0)