static void Main(string[] args) { Console.WriteLine("Hello World!"); SingletonDemo1.Test(); SingletonDemo2.Test(); }
public static void Test() { SingletonDemo2 s1 = SingletonDemo2.Instance(); SingletonDemo2 s2 = SingletonDemo2.Instance(); if (s1.Equals(s2)) { Console.WriteLine("see, only one instance!"); } }