

public class A
{
public static int X;
static A()
{
X = B.Y + 1;
}
}
public class B
{
public static int Y = A.X + 1;
static B()
{ }
}
调用代码:


this.rtxtLog.Text += String.Format("{0} ,{1}\t\n", B.Y, A.X);
//其中,this.rtxtLog.Text为测试控件的Text,此处仅仅描述后半部分的调用
运行结论:2,1
结论:静态构造函数仅运行一次