Working with the Main Method and Command-Line Arguments - CSharp Custom Type

CSharp examples for Custom Type:Method Parameter

Description

Working with the Main Method and Command-Line Arguments

Demo Code

using System;//w  w  w. j  a  v a2  s.c om
class CommandLine
{
   public static void Main(string[] args)
   {
      int i=0;
      if (args.Length <= 0 )
      {
         Console.WriteLine("No Command Line arguments were provided.");
         return;
      }
      else
      {
         for( i = 0; i < args.Length; i++)
         {
            Console.WriteLine("Argument {0} is {1}", i+1, args[i]);
         }
      }
   }
}

Result


Related Tutorials