Exemplo n.º 1
0
 public static Singleton getInstance()
 {
     if(cb == null){
         cb = new Singleton();
     }
     return cb;
 }
Exemplo n.º 2
0
 public static Singleton GetObject()
 {
     if(_obj==null)
     {
         _obj = new Singleton();
     }
     return _obj;
 }
Exemplo n.º 3
0
 public static Singleton GetInstance()
 {
     if (_instance == null)
     {
         lock (_lockObject)
         {
             _instance = new Singleton();
         }
     }
     return _instance;
 }
Exemplo n.º 4
0
 public static Singleton GetInstance()
 {
     return(_uniqueInstance ?? (_uniqueInstance = new Singleton()));
 }
Exemplo n.º 5
0
        private static void DisplayEmployee()
        {
            Singleton employee = Singleton.GetInstance;

            employee.PrintDetails("From Employee");
        }
Exemplo n.º 6
0
        private static void DisplayStudent()
        {
            Singleton student = Singleton.GetInstance;

            student.PrintDetails("From Student");
        }
Exemplo n.º 7
0
 static void Main(string[] args)
 {
     Singleton.GetInstance().ShowMessage();
 }