2011年10月26日

c# 阻塞队列

摘要: /// <summary> /// 阻塞队列[.net 4.0 貌似自带了阻塞队列] /// </summary> public class BlockQueue<T> { public readonly int SizeLimit = 0; private Queue<T> _inner_queue = null; public int Count { get { return _inner_queue.Count; } } private ManualRes... 阅读全文

posted @ 2011-10-26 11:33 雨渐渐 阅读(4589) 评论(0) 推荐(0)

生产-消费-生产-消费模型

摘要: 原始地址:http://blog.csdn.net/shellwin/article/details/5868760(1) Consumer表示消费类,其中定义了一个ArrayList表示容器,容器中装的是Goods这个类的对象。主要是方法Consumption,这个是表示消费的方法。具体代码如下:public class Consumer{ArrayList container = null;//得到一个容器public Consumer(ArrayList container){this.container = container;}//定义一个消费的方法public void Consu 阅读全文

posted @ 2011-10-26 10:25 雨渐渐 阅读(433) 评论(0) 推荐(0)

命令模式

摘要: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace CommandSchema{class Program{static void Main(string[] args){Barbecue boy=new Barbecue();Command bakeMuttonCommand=new BakeMuttonCommand(boy);Command bakeChickenWingCommand=new BakeChickenWingCommand(boy);Wait 阅读全文

posted @ 2011-10-26 10:11 雨渐渐 阅读(138) 评论(0) 推荐(0)

导航