why is "Main" in C# not a "public" static ?????

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<p align=left><font face=Arial size=2></font> 
Hi All,
<p align=left> 
<p align=left>I am trying to understand why in C#  the entry point function
<p align=left> 
<p align=left>
<div class=codeseg>
<div class=codecontent>
<div class=codesniptitle><span style="width:100% Code Snippet
<p align=left>static void Main(string[] args)
<p align=left> 
<p align=left> 

is not explicitly declared as "public" . As the default access specifier for any method in a class is "private", the above declaration would make the entry point function "Main" as a private method.
<p align=left> 
<p align=left>My question is , if the "Main" method is private how is the runtime going to invoke this static function ?? .  Please enlighten if I am missing something.
<p align=left> 
<p align=left>Thanks a million in advance
<p align=left> 
<p align=left>Cheers
<p align=left>Kodez

View the full article
 
Back
Top