swollaws
漂泊中体会不到生活的味道,那是因为吃不到老妈烧的饭。
摘要: 实例一、using System;namespace SimpleDelegate{ //定义委托 delegate double DoubleOp(double x); class MainEntryPoint { static void Main() { //实例化 DoubleOp[] operations = { new DoubleOp(MathsOperations.Multiply... 阅读全文
posted @ 2009-07-06 15:21 swollaw 阅读(346) 评论(0) 推荐(0) 编辑
摘要: 一、在C#中声明委托定义委托和方法雷同,但是没有方法体,定义的前面要加上关键字delegate:delegate string GetText();。根据定义的可见性,可以在委托定义上添加一般的访问修饰符:public、private和protected等:public delegate string GetText();。因为定义委托基本上是定义一个新类,所以可以在定义类的任何地方定义委托,即可... 阅读全文
posted @ 2009-07-06 11:45 swollaw 阅读(216) 评论(0) 推荐(0) 编辑