//Private constructor is used to prevent //creation of instances with 'new' keyword outside this class static SingletonStatic() { Print.ToConsol("Instantiating inside the private constructor."); numberOfInstances++; Print.ToConsol("Number of instances ={0}", numberOfInstances); }
//Private constructor is used to prevent //creation of instances with 'new' keyword outside this class private Singleton() { Print.ToConsol("Instantiating inside the private constructor."); numberOfInstances++; Print.ToConsol($"Number of instances in Constraction = {numberOfInstances}"); }