Singleton Class :

A singleton is a class which only allows a single instance of itself to be created, and usually gives simple access to that instance.
public sealed class Singleton{
    static Singleton instance=null;
    static readonly object padlock = new object();
   Singleton()    {    }
    public static Singleton Instance    {
        get {
            lock (padlock)
            {
                if (instance==null) {  instance = new Singleton();}
                return instance;
           } }    } }

Comments (0)