can application have Multiple Main() ??

  • Thread starter Thread starter chandu
  • Start date Start date
C

chandu

Hello,

I had one doubt,please clarify it.

Main is the entry point for the application.
if i had multiple overloaded main methods in my application.
how the compiler recognizes the original Main().????
 
quotes from the specs:

<quote>
However, within a single program, no class or struct shall contain more than
one method called Main whose definition qualifies it to be used as an
application entry point. Other overloaded versions of Main are permitted,
however, provided they have more than one parameter, or their only parameter
is other than type string[].
<snip>
It is possible for more than one of these classes or structs to contain a
method called Main whose definition qualifies it to be used as an
application entry point. In such cases, one of these Main methods shall be
chosen as the entry point so that application startup can occur. This choice
of an entry point is beyond the scope of this specification
</quote>

In VS that choice can be made in the properties pane of the project.
 
....but always one entry point. A second main method but only one entry
point. I thought that was what you were asking, my apologies if i
misinterpreted your original question.


Christof Nordiek said:
quotes from the specs:

<quote>
However, within a single program, no class or struct shall contain more
than one method called Main whose definition qualifies it to be used as an
application entry point. Other overloaded versions of Main are permitted,
however, provided they have more than one parameter, or their only
parameter is other than type string[].
<snip>
It is possible for more than one of these classes or structs to contain a
method called Main whose definition qualifies it to be used as an
application entry point. In such cases, one of these Main methods shall be
chosen as the entry point so that application startup can occur. This
choice of an entry point is beyond the scope of this specification
</quote>

In VS that choice can be made in the properties pane of the project.

chandu said:
Hello,

I had one doubt,please clarify it.

Main is the entry point for the application.
if i had multiple overloaded main methods in my application.
how the compiler recognizes the original Main().????
 

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