I read on MSDN that the output of
using System;
class Test
{
static void Main()
{
Console.WriteLine("{0} {1}", B.Y, A.X);
}
public static int F(string s)
{
Console.WriteLine(s);
return 1;
}
}
class A
{
public static int X = Test.F("Init A");
}
class B
{
public static int Y = Test.F("Init B");
}
can be either of
Init A
Init B
1 1
or
Init B
Init A
1 1
but I can't figure out why the order of excecution of X's initializer and Y's initializer could occur in either order?
I always get the second result (which I expected) on my system but cannot see how the first one could also be achieved?
Thanks.