0

I know that we can have many overload of Main method and have different methods. But to run the C# class, class should have main() method with signature as public static void main(String[] args){} If you do any modification to this signature, the compilation will be successful. But, You will get a runtime error as main method not found. I have two questions.

  1. How to change the starting point of an C# program to another method(including any overload of Main method)?
  2. What is the default class is chosen for run? Can we change it ??

    public static void main(String[] args) { }

prisar
  • 3,041
  • 2
  • 26
  • 27
Hamed Sanaei
  • 121
  • 13
  • 2
    Take a look at the "Application Startup" section the language specification (https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/basic-concepts - C# 6 draft spec.) – Chris Aug 26 '18 at 10:59
  • Are you referring to a dll? The main function in a dll is optional and only is used when the dll is started from cmd.exe. Any public method can be called in a dll when called from another complied application. – jdweng Aug 26 '18 at 11:10

0 Answers0