There can me more than 1 Main() functions in a C# program

Skill/Topic: Intermediate
A) Yes
B) No
Explanation: While compiling we can specify which Main() function to start in

Showing Answers 1 - 13 of 13 Answers

Ziaul Haque

  • Dec 14th, 2005
 

It is possible to have multiple Main() methods in C# program. But, you have to explicitly identify which Main method is the entry point at the run-time. C++ and Java Programmers, take note that Main starts with capital 'M' and the return type is void.

  Was this answer useful?  Yes

samiksc

  • Jul 11th, 2007
 

There can be more than one Main() functions in different classes in a c# program. While compiling you have to specify the startup object - so the compiler knows which Main() to use as an entry point.
In the same class you can't have 2 Main() overloads - compiler gives an error for multiple entry points

  Was this answer useful?  Yes

shyinsi

  • Jan 19th, 2009
 

Yes , While Compiling we can specify which main to use by going to properties and setting the startup object.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions