.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

猜你喜欢

转载自www.cnblogs.com/sxjljj/p/11370620.html
今日推荐