I've come across a C# behavior that I would like to understand. Consider a class like this:
public class SomeSingleton
{
public static SomeSingleton Default = new SomeSingleton();
private static int field = 0;
private SomeSingleton()
{
field = 1;
}
public int GetField()
{
return field;
}
}
Now, let's call GetField() method:
var field = SomeSingleton.Default.GetField();
I am getting 0 as if the instance constructor was skipped. Why?