Example #1
0
        public void Demonstrate()
        {
            var instance = SingleTon.GetInstance();

            Console.WriteLine($"Creating Instance with Name {instance.Name}");

            Console.WriteLine("changing the name to Test 1 and creating new instance..");

            instance.Name = "Test 1";

            var inst2 = SingleTon.GetInstance();

            Console.WriteLine($"New object Name is {inst2.Name}");
        }
Example #2
0
 public static SingleTon GetInstance()
 {
     return(_instance ?? (_instance = new SingleTon()));
 }