
      What is the purpose of main() function in C#?Main function
        is the entry point for your program. When you execute a program, the operating
        system will check for the Main function and execute the code statements
        in it. Consider the following example:  
 namespace Application1 { public class sampleClass { public static void sampleMethod() { Console.WriteLine("Executing sampleMethod.."); } } } When you
        execute the above program, you will end up in the following error: This is because the above program does not include Main function. To make it work, include the following Main function inside sampleClass: public static
        void Main() { Now when
        you execute the program, you will get the following output: The Main function can take four different forms. They are mentioned below: static void
        Main() { } But remember
        that your program can have only one Main function which can have any of
        the above shown signatures. If multiple Main functions are defined, then
        you will get this error: 
        
 
  |