I know that for Console/Windows application in C#, “Main” method is entry point to run the application.
If we have hundreds of classes in our application, how the runtime will detect which class contains the “Main” method to run the application?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The compiler looks for
static void Main(string[])or
static int Main(string[])to determine the entry point.
Main()may also be declared without thestring[]argument. You only need to specifically set the project setting if you have multiple classes withMain()functions.Here’s MSDN’s detailed answer for you.