What is a singleton?
Md. Raskinur Rashid
A singleton is a design pattern used when only one instance of an object is created and shared; that is, it only allows one instance of itself to be created. Any attempt to create another instance simply returns a reference to the first one. Singleton classes are created by defining all class constructors as private. In addition, a private static member is created as the same type of the class, along with a public static member that returns an instance of the class. Here is a basic example:public class SingletonExample {private static SingletonExample _Instance;private SingletonExample () { }public static SingletonExample GetInstance() {if (_Instance == null) {_Instance = new SingletonExample ();}return _Instance;} }
Refer http://dotnetmagic.blogspot.in/
http://www.c-sharpcorner.com/code/1990/what-is-singleton-design-pattern.aspx
This is helpful http://www.dotnetperls.com/singleton
Singleton is a design pattern that restricts the instantiation of a class to one object. We are achieving this through a static instance variable & private constructor. This is useful when exactly one object is needed to coordinate actions across the system.
single ton is a mechanism in which we can create a single instance(object) of class and this obj is used as a reference when we required another object of class
http://www.dotnetperls.com/singleton
singleton is a class which we can create only one instance.