关于C# 设计模式 Bridge 桥接模式
using System;
using System.Collections.Generic;
using System.Text;
///Bridge(桥接)模式将抽象部分与它的实现部分进行分离,使它们都可以独立地变化。
///add by jzh 2007-04-18
namespace DesignPattern
{
class Abstraction
{
protected Implementation impDefault;
public
using System;
using System.Collections.Generic;
using System.Text;
///Bridge(桥接)模式将抽象部分与它的实现部分进行分离,使它们都可以独立地变化。
///add by jzh 2007-04-18
namespace DesignPattern
{
class Abstraction
{
protected Implementation impDefault;
public
using System;
using System.Collections.Generic;
using System.Text;
///Singleton(单件)模式用于保证一个类仅有一个实例,并提供一个访问该实例的全局访问点。
///add by jzh 2007-04-15
namespace DesignPattern
{
class Singleton
{
private static Singleton _instance;
publi
using System;
using System.Collections.Generic;
using System.Text;
///Visitor(访问者)模式 用于表示一个作用于某对象结构中的各元素的操作,在不改变各元素的类的前提下定义作用于这些元素的新操作。
///add by jzh 2007-04-15
namespace DesignPattern
{
/// <summary>
/// Visitor(访问者):为该对象结构中
using System;
using System.Collections.Generic;
using System.Text;
///Strategy(策略)模式又称Policy模式,用于定义一系列的算法,把它们一个个封装起来,并且使它们可相互替换。
///add by jzh 2007-04-29
namespace DesignPattern
{
/// <summary>
/// strategy
定义所有支持的算法的公共接口.
using System;
using System.Collections.Generic;
using System.Text;
///State(状态)模式用于把一个对象的内部状态从对象中分离出来,形成单独的状态对象,所有与该状态相关的行为都放入该状态对象中。
///add by jzh 2007-04-15
namespace DesignPattern
{
abstract class State
{
protected string strS
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
///Prototype(原型)模式 用于解决在直接访问对象不方便或不符合要求时,为这个对象提供一种代理,以控制对该对象的访问。
///add by jzh 2007-04-15
namespace DesignPattern
{
/// <summary>
//
using System;
using System.Collections.Generic;
using System.Text;
///Prototype(原型)模式用于动态抽取当前对象运行时的状态,从自身构造出一个新的对象,即自身的拷贝(往往是深拷贝)。
///add by jzh 2007-04-15
namespace DesignPattern
{
abstract class AbstractPrototype
{
abstract pub
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
///Observer(观察者)模式又被称作发布-订阅(Publish-Subscribe)模式,用于定义对象间的一对多的依赖关系,
///当一个对象的状态发生改变时,所有依赖于它的对象都得到通知并被自动更新。
///add by jzh 2007-04-15
namespace
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
///Iterator(迭代器)模式又称Cursor(游标)模式,用于提供一种方法顺序访问一个聚合对象中各个元素, 而又不需暴露该对象的内部表示。
///add by jzh 2007-04-26
namespace DesignPattern
{
class Node
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
///Interpreter(解释器)模式描述了如何为简单的语言定义一个文法。
///add by jzh 2007-04-15
namespace DesignPattern
{
class ContextMi
{
private string _statement
using System;
using System.Collections.Generic;
using System.Text;
///Facade(外观)模式为子系统中的各类(或结构与方法)提供一个统一的接口/界面,隐藏子系统的复杂性,使子系统更加容易使用。
///add by jzh 2007-04-15
namespace DesignPattern
{
class SubSystemA
{
public void OperationX()
using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
///Composite(组合)模式将对象组合成树形结构以表示“部分-整体”的层次结构,对单个对象和复合对象的使用具有一致性。
///add by jzh 2007-04-15
namespace DesignPattern
{
abstract class Componen
using System;
using System.Collections.Generic;
using System.Text;
///Command(命令)模式可用于将一个请求封装为一个对象,以便使用不同的请求进行参数化。
///add by jzh 2007-04-15
namespace DesignPattern
{
abstract class Command
{
abstract public void Execute();
prot
using System;
using System.Collections.Generic;
using System.Text;
///Builder(生成器)模式将一个复杂对象的构建与它的表示分离,使得同样的构建过程可以创建不同的表示。
///add by jzh 2007-04-15
namespace DesignPattern
{
/// <summary>
/// Director(指导者)角色:调用具体建造者角色以创建产品对象。
using System;
using System.Collections.Generic;
using System.Text;
///Adapter(适配器)模式又称Wrapper模式,
///通过适配器解决两个已有接口之间匹配问题。
///add by jzh 2007-04-13
namespace DesignPattern
{
/// <summary>
/// 目标(Target)角色:目标接口。
/// </sum