Home > DeveloperSection > Interviews > What is a singleton in C#?

Posted on    September-22-2014 2:05 AM

 C# .NET  C# 
 2 Answer(s)
  794  View(s)
Rate this:

Sumit Kesarwani

Total Post:782

Posted on    September-22-2014 2:05 AM

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

Chintoo Semi

Total Post:79

Posted on    September-24-2014 12:06 AM

nice post

Don't want to miss updates? Please click the below button!

Follow MindStick