If the project is compiled using /main switch with the compiler then the project compiles successfully.
For example: class A { public static void Main(string[] args) { Console.WriteLine("Main in class A"); } }
class B { public static void Main(string[] args) { Console.WriteLine("Main in class B"); } }
Now compile with the /main switch with the C# compiler like csc MultipleMain.cs /main:A
This will compile without error and while executing it will show Main in class A
Attempting to compile an application consisting of multiple classes with defined Main methods and not specifying the /main switch will result in a compiler error.
If a Project has more than one Main method and when you try to Execute the project you will recive an error i.e ConsoleApplication1.exe has more than one entry point defined. But you can explictly select which Main Method has to be execute
Right Click on Project --> Select Properties --> Application --> Select the Main in Startup Object