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?
The compiler looks for
static void Main(string[])
or
static int Main(string[])
to determine the entry point. Main()
may also be declared without the string[]
argument. You only need to specifically set the project setting if you have multiple classes with Main()
functions.
Here's MSDN's detailed answer for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With