3 ms·
static constructor does get called first. The problem is in this line: static readonly Singleton _instance = new Singleton(); The static variable depends on th
by bursurk 12y ago
static constructor does get called first. The problem is in this line:
static readonly Singleton _instance = new Singleton();
The static variable depends on the instance. So static gets called first and starts running, but before it could call the Console.WriteLine, instance of Singleton gets created due to the above line and hence the instance constructor.