摘要: 委托与事件的经典示例:using System;using System.Collections.Generic;using System.Text;namespace Delegate{ // 热水器 public class Heater { private int temperature; public string type = "RealFire 001"; // 添加型号作为演示 public string area = "China Xian"; // 添... 阅读全文
posted @ 2012-06-01 10:39 flytothemoon 阅读(488) 评论(0) 推荐(0) 编辑
摘要: 排序10000个数字的数组,看看冒泡和Sort()的速度比较:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Diagnostics;namespace StopWatch{ class CArray { static void Main(string[] args) { CArray nums = new CArray(10000); List<int> nums2 =... 阅读全文
posted @ 2012-05-31 17:45 flytothemoon 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 委托用于将方法作为参数传递给其他方法,委托应用的示例:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace DelegateApp{ public class Person { public string Name { get; set; } public int Age { get; set; } } class Program { //定义FILTER委托 publ... 阅读全文
posted @ 2012-05-31 13:58 flytothemoon 阅读(379) 评论(0) 推荐(0) 编辑