using System; class Main1 { public static void Main() { Console.WriteLine("Main1"); } } class Main2 { public static void Main() { Console.WriteLine("Main2"); } }
To compile this application such that the Main1.Main method is used as the application's entry point, you'd use this switch: -
csc MultipleMain.cs /main:Main1
Changing the switch to /main:Main2 would then use the Main2.Main method.
Obviously, because C# is case-sensitive, you must be careful to use the correct case of the class in the switch as well. In addition, 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.