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 you have the better answer, then send it to us. We will display your answer after the approval.