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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top