using RydoZone; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace RydoZone { public sealed class Rydo { private static int counter = 0; //private static Rydo instance = null; private static Rydo instance = new Rydo(); //private static object obj = new Object(); public static Rydo GetInstance { get { return instance; } } private Rydo() { counter++; Console.WriteLine("Counter Value is" + counter.ToString()); } private void PrintDetails() { Console.WriteLine("I am Print Method of Singleton Class"); } public void ok() { Console.WriteLine("I am Print Method of Singleton Class"); } } } public class Mained { static void Main() { Parallel.Invoke(() => RydoCallfromHamas(), () => RydoCallfromUS()); // Dummy MultiThreaded Environment Console.ReadKey(); } private static void RydoCallfromHamas() { Rydo r = Rydo.GetInstance; Console.WriteLine("Hamas got the Rydo Instance"); } private static void RydoCallfromUS() { Rydo r = Rydo.GetInstance; Console.WriteLine("US got the Rydo Instance"); } }
Quote:The Question is : Why only object is being created here ?
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)