一风子

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2020年6月1日

摘要: 多例模式也比较简单就是扩展多个单例不同类项组成一个组织,来调用 下面是示例: public class MultipleCasePattern { private Dictionary<string,Vehicle> Vehicles; public void Main() { Vehicles = 阅读全文
posted @ 2020-06-01 23:45 一风子 阅读(173) 评论(0) 推荐(0)

摘要: 单例模式比较简单,就是单个实例意思! public class SingletonPattern { public void Main() { Singleton.Instance = new Singleton(); Singleton.Instance.Print(); } } public c 阅读全文
posted @ 2020-06-01 23:41 一风子 阅读(19) 评论(0) 推荐(0)

摘要: 代理是把同样的方法赋予对方 委托是创建和某个对象同样的方法 两个合并起来操作,如下: public class DelegateAndAgentPattern { public void Main() { Boss boss = new Boss(); Secretary secretary = n 阅读全文
posted @ 2020-06-01 22:07 一风子 阅读(42) 评论(0) 推荐(0)

摘要: 参考自书籍:24种设计模式介绍与6大设计原则 策略模式的好处就是:体现了高内聚低耦合的特性 public class Strategy { private Context context; public void Main() { Console.WriteLine("发生了第一个事件!需要想个办法 阅读全文
posted @ 2020-06-01 18:59 一风子 阅读(19) 评论(0) 推荐(0)

摘要: 记录ref的用法如下: public class ValueTransfer { private int num1 = 1; private Vector2 _vector2; public void Main() { _vector2 = Vector2.Zero; SetValueNoRef(n 阅读全文
posted @ 2020-06-01 09:25 一风子 阅读(587) 评论(0) 推荐(0)