设计模式---翻译器模式
1 | using System; |
CSDN被和谐期间的Blog都发到百度空间去了
粘贴回来格式一片混乱,百度似乎还有图床保护?干脆留个地址在这里
设计模式---享元模式
1 | using System; |
设计模式---中介者模式(打出来是“终结者.......”)
1 | using System; |
设计模式---命令模式
设计模式—命令模式
1 | using System; |
设计模式---职责链模式
2008年08月17日 星期日 下午 04:28
1 | using System; |
设计模式---桥接模式
2008年08月15日 星期五 下午 05:23
松耦合
1 | using System; |
设计模式---单例模式(singleton)
设计模式—单例模式(singleton)
1 | using System; |
设计模式---迭代器模式(昨天停电了......)
设计模式—迭代器模式(昨天停电了……)
设计模式---备忘录模式(CSDN没有恢复迹象......)
设计模式—备忘录模式(CSDN没有恢复迹象……)
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication1
{
class 人物状态
{
private int _血;
private int _气;
public 人物状态()
{
_气 = 100;
_血 = 100;
}
public int 血
{
get { return _血; }
set { _血 = value; }
}
public int 气
{
get { return _气; }
set { _气 = value; }
}
public 存档 存档()
{
return new 存档(_血, _气);
}
public void 读档(存档 c)
{
this.气 = c.气;
this.血 = c.血;
}
public void 战斗()
{
System.Random r = new System.Random();
this._血 = r.Next(100);
this._气 = r.Next(100);
}
public void ShowState()
{
Console.WriteLine(this.气 + " " + this.血);
}
}
class 存档
{
private int _气;
private int _血;
public 存档(int x, int q)
{
this._气 = q;
this._血 = x;
}
public int 气
{
get { return _气; }
}
public int 血
{
get { return _血; }
}
}
class 管理器
{
private 存档 savedfile;
public 存档 SavedFile
{
get { return savedfile; }
set { savedfile = value; }
}
}
class 调用者
{
public static void Main()
{
人物状态 r = new 人物状态();
r.ShowState();
管理器 g = new 管理器();
g.SavedFile = r.存档();
r.战斗();
r.ShowState();
r.读档(g.SavedFile);
r.ShowState();
Console.Read();
}
}
}
``
设计模式---组合模式(CSDN依然没有恢复迹象......)
设计模式—组合模式(CSDN依然没有恢复迹象……)
1 | using System; |
设计模式---适配器模式(从百度转回来的)
1 | using System; |
设计模式---状态模式(今天CSDN竟然上不去,暂时发在这里) (从百度空间转回来的)
设计模式—状态模式(今天CSDN竟然上不去,暂时发在这里)
1 | using System; |
设计模式---抽象工厂模式+反射+配置文件
1 | using System; |
设计模式---观察者模式(恐怖袭击、地震的例子,有类关系图)
1 | using System; |
设计模式---建造者(Builder)模式,有关系图
1 | using System; |
设计模式--外观模式
1 | using System; |
设计模式--模板方法模式(照旧,有类关系图)
1 | using System; |
设计模式--原型模式(附带类关系图一张)
1 | using System; |
设计模式--工厂模式
1 | using System; |
设计模式--代理模式的简单实现(C#)+类关系图
1 | using System; |
装饰模式的简单实现(C#)内有图一张,嘿嘿.....
1 | using System; |
策略模式的简单应用(C#)
1 | using System; |
简单工厂的最最简单应用(C#)
简单工厂的最最简单应用
1 | using System; |