Why does main{} always include a parameter string array?

  • Thread starter Thread starter gwainguard
  • Start date Start date
G

gwainguard

Hi from reading the ECMA spec. I know understand that the bracketed
code after 'void Main' is an instruction that method Main accepts a
string parameter array.

Can someone explain to me why this is so? and why by default this
method always accepts string arguments?

Indebted for your time,

GM.


class Program
{
static void Main(string[] args)
{
}
}
 
Thankyou very much,

I can see why it is there now and have just written a small program to
echo the first command line argument and it worked which proves your
point!

Many Thanks,

GM.
 
It's absolutely not necessary to have params in Main method.
Take into account that the key instruction not "void Main" but "static Main".

It has string array because it's the way to get your param from command line

--
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
 

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