Using system;
Namespace pattern {/// /// summary description for class1. /// summary> public class singleton {private static singleleton singleton singleton singleton singleton singleton singleton singleton singleton } Public static singleleton getinstance () {if (son == null) SON = new singleleton (); return SON;}}} // single piece // Singleton S1 = Singleton.GetInstance (); // console.writeline S1.GETHASHCODE (). TOSTRING ()); // Singleton S2 = Singleton.GetInstance (); // console.writeline (S2.GETHASHCODE (). toString ()); /// Customer Cus1 = New Customer () ; // console.writeline (Cus1.getHashcode (). TOSTRING ()); // Customer Cus2 = New Customer (); // console.writeline (Cus2.gethashcode (). Tostring ()); // // (S1.Equals (S2)) Console.WriteLine ("S1 == S2"); // // IF (Cus1.equals (CUS2)) Console.Writeline ("CUS2 == Cus2");