
设计模式
lxtql
这个作者很懒,什么都没留下…
展开
-
设计模式——单列模式 Singleton
需求:某个类型的实例在程序的内存中只有1个,即类只实例化一次实现 1 双层if 加锁 赖汉式单例using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace Singleton { /// <summar原创 2016-07-16 14:59:47 · 346 阅读 · 0 评论 -
设计模式——简单工厂 SimpleFactory
场景:解除上端对细节的依赖,把细节包一层,在另一层中处理抽象类using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;namespace DesignMode.Interface { public abstract cl原创 2016-07-16 16:42:36 · 385 阅读 · 0 评论 -
设计模式——工厂方法 FactoryMethod
FactoryMethod原创 2016-07-18 22:33:30 · 380 阅读 · 0 评论 -
设计模式——抽象工厂
抽象工厂关注点是:一个工厂里面可以创建多种类型的实例 比如 既可以创建 Phone 也可以创建Pad 抽象工厂包含多少个职责,分别创建不同类型的实例 抽象工厂和简单工厂的区别在于,工厂可以扩展平板基类using System; using System.Collections.Generic; using System.Linq; using System.Text; using原创 2016-07-18 23:16:09 · 504 阅读 · 0 评论