首页 > 代码库 > 单例模式的创建:

单例模式的创建:

public class Myclass

{

  private Myclass()

     {

      }

      public static Myclass Instance

     {

          get
            {
                if (_instance==null||_instance.IsDisposed)//窗体应用程序才有IsDisposed
                {
                    _instance=  new MemberForm();
                }
                return _instance;
            }

      }

 

}

单例模式的创建: