Singleton Pattern

“Ensure a class only has once instance, and provide a global point of access to it.”

The Singleton Pattern is a Creational pattern. In programming, you may need to make sure that there is only one instance of a class running.

public class Singleton
{
  private static readonly Singleton instance = new Singleton();
 
  private Singleton()
  {
  }
 
  public static Instance
  {
    get
    {
      return instance;
    }
  }
}