9
Reply

What is a singleton?

Md. Raskinur Rashid

Md. Raskinur Rashid

9 years ago
1.7k
0
Reply

    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/

    Rajesh Singh
    8 years ago
    0

    http://www.c-sharpcorner.com/code/1990/what-is-singleton-design-pattern.aspx

    Rajesh Singh
    8 years ago
    0

    This is helpful http://www.dotnetperls.com/singleton

    Hashim Shafiq
    9 years ago
    0

    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.

    Sujeet Suman
    9 years ago
    0

    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

    Rahul Prajapat
    9 years ago
    0

    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

    Munesh Sharma
    9 years ago
    0

    singleton is a class which we can create only one instance.

    Nitu S
    9 years ago
    0