The Singleton Design Pattern is the standard way programmers create classes which are designed to have one and only one instantiation at any point in time. These classes can be used for configurations or settings objects which are globally available and which need to maintain state when being read or updated by various portions of the application.
This is accomplished by making the class Constructor private so that it cannot be accessed. This stops the class from being instantiated by code external to the class itself. Then a public property is exposed which retrieves a reference to an existing instance of the class stored in a local variable or if an instance does not yet exist the class creates a new instance and saves the reference for later calls.
Example Code:

Published by