Main function in c# and return type

Below is a sample source code demonstrating the Main function with no return type and return type.

Example for return type of void

class Program     
{         
   static void Main(string[] args)         
   {             
     Console.WriteLine("Return type is void");         
   }     
}

Example for return type of int

static int Main(string[] args)         
{             
   Console.WriteLine("Return type is int");             
   return 0;                     
}

 

 

%d