Curious: static void Main() does not to be public?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I just found that program entry point static void Main() does not need to be
public!

Is that an violation of language infrastructure and runtime security?
 
Not really as this method isn't called by managed code but rather by the runtime itself. In fact you could argue that its good practice to make it non-public as it prevents any managed code calling it

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

I just found that program entry point static void Main() does not need to be
public!

Is that an violation of language infrastructure and runtime security?
 
Back
Top