2012年8月19日

单例模式就是保证在整个应用程序的生命周期中,在任何时刻,被指定的类只有一个实例,并为客户程序提供一个获取该实例的全局访问点。泛型单例:单例模式 1 public class Singleton<T> where T:new() 2 { 3 /// <summary> 4 /// 对象实例 5 /// </summary> 6 private static readonly T Inst=new T(); 7 /// <summary> 8 /// 获取 类型 单例 9 ...
posted @ 2012-08-19 11:01 亚尔斯兰 阅读(251) 评论(0) 推荐(0)

2012年8月18日

摘要: 工作需要,写个泛型池,线程安全,分享一下。View Code 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 5 namespace Ch.Common 6 { 7 public class Pool<T> where T: class,new() 8 { 9 /// <summary> 10 /// 对象容器 11 /// </summary> 12 protected T[] Contai... 阅读全文
posted @ 2012-08-18 15:36 亚尔斯兰 阅读(155) 评论(0) 推荐(0)

导航

< 2025年6月 >
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 1 2 3 4 5
6 7 8 9 10 11 12

统计

点击右上角即可分享
微信分享提示