Esempio n. 1
0
 public static GodObject GetInstance()
 {
     if (_instance == null)
     {
         _instance = new GodObject();
     }
     return(_instance);
 }
Esempio n. 2
0
        public override void ExecuteSample()
        {
            base.ExecuteSample();
            var objectA = GodObject.GetInstance();
            var objectB = GodObject.GetInstance();

            Console.WriteLine($"Objects are equal: {objectA.Equals(objectB)}");
            Console.WriteLine($"Objects are equal: {Object.ReferenceEquals(objectA, objectB)}");
        }