c# - 为什么允许入口点是私有(private)的?

标签 c# .net

<分区>

这实际上是如何工作的?我认为 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.

Source

此外,there's another question此处已经涵盖了该主题。

关于c# - 为什么允许入口点是私有(private)的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9760895/

相关文章:

c# - 无法在 .Net (C#) 中使用 ajax 发送基本的非 MVC 表单

c# - 传递我的逗号分隔字符串不会在 SQL 中生成结果

c# - 性能/风格 : Changing an object by reference vs returning a copy in C#

c# - SessionState stateConnectionString 和 sqlConnectionString

c# - MVC/实体代码优先的多个上下文,它们之间具有参照完整性

c# - 在 xamarin.ios 中的 View Controller 之间传递数据

c# - 等同于 C# 中的 php fmod

c# - 使用 WCF 的在线多人游戏

.net - JQuery 工具工具提示与 UpdatePanel

c# - 是否存在 Application.Exit() 不引发 FormClosing 事件的情况?