

Predict the Output Challenge in C#, part 3 - bursurk
http://www.volatileread.com/Wiki/Index?id=2092

======
koyote
These are quite good and definitely result in quite surprising output in some
cases.

I would have liked the descriptions/answers to be a bit more detailed though.
For example, why is the static constructor called only after the instance
constructor (in part 2)? As far as I can see in the docs, this should not be
the case?

~~~
bursurk
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.

