Md. Raskinur Rashid
What is a singleton?
By Md. Raskinur Rashid in .NET on Jan 11 2015
  • Md. Raskinur Rashid
    Jan, 2015 11

    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;} }

    • 4
  • Rajesh Singh
    Dec, 2015 13

    Refer http://dotnetmagic.blogspot.in/

    • 0
  • Rajesh Singh
    Dec, 2015 5

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

    • 0
  • Hashim Shafiq
    Aug, 2015 21

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

    • 0
  • Sujeet Suman
    Jun, 2015 19

    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.

    • 0
  • Rahul Prajapat
    May, 2015 30

    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

    • 0
  • Pankaj  Kumar Choudhary
    Mar, 2015 29

    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

    • 0
  • Munesh Sharma
    Feb, 2015 14

    http://www.dotnetperls.com/singleton

    • 0
  • Nitu S
    Jan, 2015 20

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

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS