Display the Command line parameters of the Main Method in C#

The Main Method in C# accepts the parameters of string Array.

You could easily display the list of parameters of the Main Method in C# by using a for/foreach loop and display the parameters like the example show below

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;

namespace ConsoleApplication4 
{     
   class Program     
   {         
     static void Main(string[] args)         
     {             
        foreach (string arg in args)                 
        Console.WriteLine("Arguments: {0}", arg);         
     }     
   } 
}
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.
Pin It

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>