Why is Main method private?

前端 未结 4 1333
抹茶落季
抹茶落季 2020-11-29 06:28

New console project template creates a Main method like this:

class Program
{
    static void Main(string[] args)
    {
    }
}

Why is it th

4条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-29 06:40

    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.

提交回复
热议问题