public class Program
{
public static void Main()
var singletonInstance = Singleton.Instance();
}
public class Singleton
// static field (to access within static method and keeping single value)
// private (to not allow to be changed outside the class)
// init to null (initial default value)
private static Singleton theInstance = null;
// the default constructor created as private and empty
private Singleton() {}
// static method only way to access theInstance field
public static Singleton Instance()
if (theInstance == null)
theInstance = new Singleton();
return theInstance;