MSDN写的should not be public,但是没有写为什么,我觉得Main特殊的函数,无论如何编译器都会认识它的,因此无所谓public或者Private * The Main method is the entry point of your program, where the program control starts and ends. * It is declared inside a class or struct. It must be static and it should not be public. (In the example above it receives the default access of private.) * It can either have a void or int return type. * The Main method can be declared with or without parameters. * Parameters can be read as zero-indexed command line arguments. * Unlike C and C++, the name of the program is not treated as the first command line argument.参考: http://msdn.microsoft.com/en-us/library/acy3edy3%28VS.80%29.aspx
MSDN写的should not be public,但是没有写为什么,我觉得Main特殊的函数,无论如何编译器都会认识它的,因此无所谓public或者Private * The Main method is the entry point of your program, where the program control starts and ends. * It is declared inside a class or struct. It must be static and it should not be public. (In the example above it receives the default access of private.) * It can either have a void or int return type. * The Main method can be declared with or without parameters. * Parameters can be read as zero-indexed command line arguments. * Unlike C and C++, the name of the program is not treated as the first command line argument.参考: http://msdn.microsoft.com/en-us/library/acy3edy3%28VS.80%29.aspx
* It is declared inside a class or struct. It must be static and it should not be public. (In the example above it receives the default access of private.)
* It can either have a void or int return type.
* The Main method can be declared with or without parameters.
* Parameters can be read as zero-indexed command line arguments.
* Unlike C and C++, the name of the program is not treated as the first command line argument.参考:
http://msdn.microsoft.com/en-us/library/acy3edy3%28VS.80%29.aspx
* It is declared inside a class or struct. It must be static and it should not be public. (In the example above it receives the default access of private.)
* It can either have a void or int return type.
* The Main method can be declared with or without parameters.
* Parameters can be read as zero-indexed command line arguments.
* Unlike C and C++, the name of the program is not treated as the first command line argument.参考:
http://msdn.microsoft.com/en-us/library/acy3edy3%28VS.80%29.aspx
同意。我猜msdn上这个描述是来自于许多年前,而且是个“权威”写的,所以也许之后的msdn维护人员备份太低没有人敢(或者没有人有那个闲心)去修改它。
没有这个必然性。任何public方法都会经历测试,是否会引起程序崩溃这要由测试说了算。而如果我们写一个什么都不做的空的Main函数并不会让程序崩溃,所以说它就会引擎程序崩溃显然是不成立的(不是真正决定是否崩溃的原因)。同样道理,如果lz测试出来Main声明为public也一样,那么msdn上的措辞显然就经不起测试,就是一个文档方面的bug。