Multiple Main Methods in C#
From this you will know what is Multiple Main Methods in C#. C# enables to define more than one class with the Main method, and 'Main' is the entry points.
Learn Multiple Main Methods in C#
C# includes a feature that enables to define more than one class with the Main method. Since 'Main' is the entry point for program execution, there are now more than one entry points. In fact, there should be only one entry point. This problem can be resolved by specifying which Main is to be used to the compiler at the time of compilation as shown below:
csc filename.cs/main:classname
The following code snippet shows how to implement multiple Main methods in C#.
using System;
class ClassA
{
public static void Main()
{
Console.WriteLine("Class A");
}
}
class ClassB
{
public static void Main()
{
Console.WriteLine("Class B");
}
}
Save this file as 'Multimain.cs' and compile it using
csc Multimain.cs/main:ClassA if you choose ClassA as entry point
or
csc Multimain.cs/main:ClassB if you choose ClassB as entry point.
But how to call a particular Main function???????????
update it now if you can