public static Singltone CreateSingltone() { if (singltone == null) { singltone = new Singltone(); return(singltone); } else { return(singltone); } }
static void Main(string[] args) { var a = Singltone.CreateSingltone(); a.GetName(); Console.WriteLine(a.GetHashCode()); var b = Singltone.CreateSingltone(); b.GetName(); Console.WriteLine(b.GetHashCode()); Console.ReadLine(); }