新的控制台项目模板创建了一个主要的方法是这样的:
New console project template creates a Main method like this:
class Program
{
static void Main(string[] args)
{
}
}
为什么,无论是主
的方法,也不是计划
类必须公开?
Why is it that neither the Main
method nor the Program
class need to be public?
程序的入口点是标有 .entrypoint
IL指令。这不要紧,如果该方法或类是公共与否,最重要的事情是这样的指令。
The entry point of a program is marked with the .entrypoint
IL directive. It does not matter if the method or the class is public or not, all that matters is this directive.