Step through the command-line arguments. - CSharp Language Basics

CSharp examples for Language Basics:Console

Description

Step through the command-line arguments.

Demo Code

using System;//w  w  w  .jav a 2s .  c o m
class MainClass
{
   public static void Main(string[] args)
   {
      // Step through the command-line arguments.
      foreach (string s in args)
      {
         Console.WriteLine(s);
      }
      // Alternatively, access the command-line arguments directly.
      Console.WriteLine(Environment.CommandLine);
      foreach (string s in Environment.GetCommandLineArgs())
      {
         Console.WriteLine(s);
      }
   }
}

Related Tutorials