Get a string array containing the command-line arguments for the current process in CSharp

Description

The following code shows how to get a string array containing the command-line arguments for the current process.

Example


//from   w  w w  .  j  ava  2s.  co  m
using System;

class Sample 
{
    public static void Main() 
    {
        String[] arguments = Environment.GetCommandLineArgs();
        Console.WriteLine("GetCommandLineArgs: {0}", String.Join(", ", arguments));
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Development »




Console
Encoding
Environment
Random