public static MultiThreadSingleton GetInstanceMethod() { lock (instanceLook) { if (multiThreadSingleton == null) { Console.WriteLine("Multithreading Environment Singleton Implementation Create Instance by Method....."); multiThreadSingleton = new MultiThreadSingleton(); } } return(multiThreadSingleton); }
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(); }