代码改变世界

随笔档案-2012年2月16日

灵活的算法处理(委托学习系列二)

2012-02-16 13:53 by 秋日愚夫, 182 阅读, 收藏,
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace DelegateDEMO{ public delegate int ArithmeticDelegate(int a , int b); //根据传入的方法地址,进行计算 public class Arithmetic { private ArithmeticDelegate arithmeticOperate; public ArithmeticDelegat... 阅读全文

只有程序员,才会做这样的梦!~~

2012-02-16 12:50 by 秋日愚夫, 158 阅读, 收藏,
摘要: 昨晚梦里,在一个破庙里突然门口阴风阵阵,道人便说鬼怪要来了。我便问为何看不到他们?道人说,因为你们不同一个 线程~~~然后便和道人讨论如何跨线程的问题了~~ 阅读全文

老鼠,猫,主人的问题(委托学习系列一)

2012-02-16 12:15 by 秋日愚夫, 314 阅读, 收藏,
摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace DelegateDEMO{ //面试试题 老鼠,猫,主人的问题 //由老鼠的活动引起老猫的醒,然后老猫在捉老鼠的时候,把主人吵醒 //要保持类与类的低耦合,于是用委托实现。 public delegate string WakeUp(); //定义委托 //老鼠 public class Mouse { public string MouseAction(... 阅读全文