public static SingletonDemo GetInstance() { if (currentInstance == null) { currentInstance = new SingletonDemo(); } return(currentInstance); }
static void Main(string[] args) { var singletonObject = SingletonDemo.GetInstance(); singletonObject.DoSomethingWiththeSingleton(); }