码迷,mamicode.com
首页 >  
搜索关键字:designpattern    ( 138个结果
DesignPattern_Behavioral_Command
void Main(){ Invoker invoker = new Invoker(); invoker.Add(new CommandA()); invoker.Add(new CommandB()); invoker.Notify();}class Receiver{ ...
分类:其他好文   时间:2014-11-17 10:36:14    阅读次数:141
DesignPattern_Creational_Prototype
void Main(){ Prototype p1=new Prototype(); Prototype p2=p1.Clone() as Prototype; object.ReferenceEquals(p1,p2).Dump();}class Prototype:IClone...
分类:其他好文   时间:2014-11-17 10:34:29    阅读次数:157
DesignPattern_Structural_Composite
void Main(){ Component root = new Composite(); Component nodeA = new Composite(); Component nodeB = new Composite(); root.Add(nodeA); r...
分类:其他好文   时间:2014-11-17 10:30:41    阅读次数:148
DesignPattern_Behavioral_Observer
void Main(){ Subject s = new Subject(); s.Add(new ObserverA(s)); s.Add(new ObserverB(s)); s.Notify();}class Subject{ List observers = n...
分类:其他好文   时间:2014-11-17 10:26:16    阅读次数:192
DesignPattern_Structural_Facade
void Main(){ Facade facade = new Facade(); facade.Show();}class Facade{ ProductA pa = new ProductA(); ProductB pb = new ProductB(); pub...
分类:其他好文   时间:2014-11-17 10:26:05    阅读次数:140
DesignPattern_Structural_Flyweight
void Main(){ FlyweightFactory.GetFlyweight("A").Show(1); FlyweightFactory.GetFlyweight("B").Show(2);}abstract class Flyweight{ public void Sh...
分类:其他好文   时间:2014-11-17 10:23:29    阅读次数:173
DesignPattern_Structural_Bridge
void Main(){ Bridge bridge = new Bridge(); bridge.Set(new ShowA()); bridge.Show(); bridge.Set(new ShowB()); bridge.Show();}class Bridge...
分类:其他好文   时间:2014-11-17 10:21:36    阅读次数:150
DesignPattern_Structural_Adapter
void Main(){ Target t = new Adapter(); t.TargetShow();}class Target{ public virtual void TargetShow(){}}class Adapter:Target{ Subject subj...
分类:其他好文   时间:2014-11-17 10:20:08    阅读次数:194
DesignPattern_Structural_Decorator
void Main(){ Component c1 = new Component(); Decorator da = new DecoratorA(); da.Decorate(c1); Decorator db = new DecoratorB(); db.Deco...
分类:其他好文   时间:2014-11-17 10:17:43    阅读次数:147
DesignPattern_Creational_SimpleFactory
void Main(){ SimpleFactory.GetProduct("A").Dump(); SimpleFactory.GetProduct("B").Dump();}class Product{}class ProductA:Product{}class ProductB:P...
分类:其他好文   时间:2014-11-17 09:11:01    阅读次数:156
138条   上一页 1 ... 9 10 11 12 13 14 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!