Access CommandLine argument in Console application in c#

By j Miracle

Here i will show how you can access CommandLine argument in ConsoleApplication in c#


public static void Main(string[] args)
{

// First method
foreach (string s in args)
{
Console
.WriteLine(s);
}
  

//Second Method
foreach (string s in Environment.GetCommandLineArgs())
{
Console
.WriteLine(s);
}


}

Access CommandLine argument in Console application in c#  (1149 Views)