Beispiel #1
0
 public static DblChkMultiThreadSingleton GetInstanceMethod()
 {
     if (dblChkMultiThreadSingleton == null)
     {
         lock (InstanceLook)
         {
             if (dblChkMultiThreadSingleton == null)
             {
                 dblChkMultiThreadSingleton = new DblChkMultiThreadSingleton();
                 Console.WriteLine("Double Check Multithreading Environment Singleton Implementation Create Instance by Method.....");
             }
         }
     }
     return(dblChkMultiThreadSingleton);
 }
Beispiel #2
0
        static void SingleTonImp()
        {
            // Standared Implementation method
            StandSingleton.GetInstanceMethod();
            // Standared Implementation Propery
            StandSingleton objStand = StandSingleton.GetInstancePropperty;

            //Multithreading Singleton Implementation Property
            MultiThreadSingleton objMulti = MultiThreadSingleton.GetInstancePropery;

            //Multithreading Singleton Implementation Method
            MultiThreadSingleton.GetInstanceMethod();

            //Double Check Multithreading Singleton Implementation Method
            DblChkMultiThreadSingleton.GetInstanceMethod();
            //Double Check Multithreading Singleton Implementation Method
            DblChkMultiThreadSingleton objDblChkMulti = DblChkMultiThreadSingleton.GetInstanceProperty;

            //Early Instance Singleton Implementation Property
            EarlySingleton objEarlySing = EarlySingleton.GetInstanceProperty;

            //Early Instance Singleton Implementation Method
            EarlySingleton.GetInstanceMethod();
        }