<分区>
这实际上是如何工作的?我认为 Main
应该被“调用”。但是,如果它被标记为私有(private),那怎么可能呢?
public class Program
{
private static void Main()
{
}
}
<分区>
这实际上是如何工作的?我认为 Main
应该被“调用”。但是,如果它被标记为私有(private),那怎么可能呢?
public class Program
{
private static void Main()
{
}
}
最佳答案
来自 bytes.com 上的 Jon Skeet:
Basically, the execution of the main method is started by special code within the CLR (or possibly code driving the CLR to start with) which doesn't need to obey the same rules.
此外,there's another question此处已经涵盖了该主题。
关于c# - 为什么允许入口点是私有(private)的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9760895/