.net设计模式

1.单例模式

public sealed class Singleton

{

        static intance=null;

        static readonly object padlock=new object();

       Singleton()
       {}

      public static Singleton Instance

     {

           get {

                      lock(padlock){

                                        if(instance==null)

                                            {instance= new Singleton(); }

                                            return instance;

                             }

              

                 }

      }

 

}

https://terrylee.cnblogs.com/archive/2005/12/09/293509.html

posted on 2019-08-17 22:17  sxjljj  阅读(172)  评论(0编辑  收藏  举报