蒋智昊的博客

蒋智昊的博客

关于C# 设计模式 Mediator 中介者模式

关于C# 设计模式 Mediator 中介者模式

using System;

using System.Collections.Generic;

using System.Text;

///Mediator(中介者)模式 用一个中介对象来封装一系列的对象之间的交互,中介者使各对象不需要显式地相互引用,从而使其耦合松散,而且可以独立地改变它们之间的交互。

///add by jzh 2007-04-30

namespace DesignPattern

{

/// <summary>

/// 抽象中

关于C# 设计模式 Memento 备忘录模式

关于C# 设计模式 Memento 备忘录模式

using System;

using System.Collections.Generic;

using System.Text;

///Memento(备忘录)模式 在不破坏封装性的前提下,捕获一个对象的内部状态,并在该对象之外保存这个状态,这样以后就可将该对象恢复到原先保存的状态。

///add by jzh 2007-04-29

namespace DesignPattern

{

/// <summary>

/// Originator(

关于C# 设计模式 TemplateMethod 模板方法模式

关于C# 设计模式 TemplateMethod 模板方法模式

using System;

using System.Collections.Generic;

using System.Text;

///Template Method(模板方法)模式定义一个操作中的算法的骨架,将具体的处理细节交给子类具体实现。

///add by jzh 2007-04-26

namespace DesignPattern

{

/// <summary>

/// 抽象模版(AbstractClass)角色

/// 定义了

关于C# 设计模式 Decorator 装饰器模式

关于C# 设计模式 Decorator 装饰器模式

using System;

using System.Collections.Generic;

using System.Text;

///Decorator(装饰器)模式 通过对已经存在的某些类进行装饰,以此来扩展一些功能。

///add by jzh 2007-04-24

namespace DesignPattern

{

/// <summary>

/// Component(抽象构件)角色:给出一个抽象接口,以规范准备接收附加责任的对象。

关于C# 设计模式 ChainOfResponsibility 职责链模式

关于C# 设计模式 ChainOfResponsibility 职责链模式

using System;

using System.Collections.Generic;

using System.Text;

///Chain of Responsibility(职责链,以下简称CoR)模式通过将多个对象串接成一条链(Chain),并沿着这条链传递上层应用传来的请求,

///直到有一个对象处理它为止,使得多个对象都有机会处理上层应用传来的请求,从而避免请求的发送者和接收者之间的耦合关系。

///add by jzh 2007-04-23

n

关于C# 设计模式 Visitor 访问者模式

关于C# 设计模式 Visitor 访问者模式

using System;

using System.Collections.Generic;

using System.Text;

///Visitor(访问者)模式 用于表示一个作用于某对象结构中的各元素的操作,在不改变各元素的类的前提下定义作用于这些元素的新操作。

///add by jzh 2007-04-15

namespace DesignPattern

{

/// <summary>

/// Visitor(访问者):为该对象结构中

关于C# 设计模式 Strategy 策略模式

关于C# 设计模式 Strategy 策略模式

using System;

using System.Collections.Generic;

using System.Text;

///Strategy(策略)模式又称Policy模式,用于定义一系列的算法,把它们一个个封装起来,并且使它们可相互替换。

///add by jzh 2007-04-29

namespace DesignPattern

{

/// <summary>

/// strategy

定义所有支持的算法的公共接口.

关于C# 设计模式 State 状态模式

关于C# 设计模式 State 状态模式

using System;

using System.Collections.Generic;

using System.Text;

///State(状态)模式用于把一个对象的内部状态从对象中分离出来,形成单独的状态对象,所有与该状态相关的行为都放入该状态对象中。

///add by jzh 2007-04-15

namespace DesignPattern

{

abstract class State

{

protected string strS

关于C# 设计模式 Observer 观察者模式

关于C# 设计模式 Observer 观察者模式

using System;

using System.Collections.Generic;

using System.Text;

using System.Collections;

///Observer(观察者)模式又被称作发布-订阅(Publish-Subscribe)模式,用于定义对象间的一对多的依赖关系,

///当一个对象的状态发生改变时,所有依赖于它的对象都得到通知并被自动更新。

///add by jzh 2007-04-15

namespace

关于C# 设计模式 Iterator 迭代器模式

关于C# 设计模式 Iterator 迭代器模式

using System;

using System.Collections.Generic;

using System.Text;

using System.Collections;

///Iterator(迭代器)模式又称Cursor(游标)模式,用于提供一种方法顺序访问一个聚合对象中各个元素, 而又不需暴露该对象的内部表示。

///add by jzh 2007-04-26

namespace DesignPattern

{

class Node