Oh, that is complex. It depends on whether the beforefieldinit
flag is set, which in turn (in C#) depends on whether there is a static constructor. And worse; in .NET 4 I believe the behaviour changed to make it more "lazy" than it used to be.
Frankly, I wouldn't code to any specific behaviour here; simply: static fields will be initialized before you try to use them, as long as you use regular code to access them.
Jon Skeet has a good write-up on this here and here
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…