应用中的单例模式


       public class SingletonProvider<T> where T : new()
       {
           SingletonProvider() { }

           public static T Instance
           {
               get { return SingletonCreator.instance; }
           }

           class SingletonCreator
           {
               static SingletonCreator() { }

               internal static readonly T instance = new T();
           }
       }

posted on 2010-06-26 17:27  o0myself0o  阅读(244)  评论(0编辑  收藏  举报

导航