Exemple #1
0
 public static Singltone CreateSingltone()
 {
     if (singltone == null)
     {
         singltone = new Singltone();
         return(singltone);
     }
     else
     {
         return(singltone);
     }
 }
Exemple #2
0
        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();
        }