namespace MyNameSpace
{
static class MyClass
{
static MyClass()
{
//Authentication process.. User needs to enter password
}
public static void MyMethod()
{
//Depends on successful completion of constructor
}
}
class Program
{
static void Main(string[] args)
{
MyClass.MyMethod();
}
}
}
以下是我假设的顺序:
- 静态构造函数的开头
- 静态构造函数的结尾
- 主函数的开头
- MyMethod的开头
- 主函数的结尾
现在,如果数字4在数字2之前开始,我的代码就会出错。这种情况可能吗?