Command line arguments are parameters supplied to the Main method at the time of invoking it for execution. To understand the concepts see the example given below:
Program of Command line argument to accept name from the command line and writes to the console. (Sample.cs)
public static void Main( string[ ] args)
console.write(" " +args);
console.write(" " +args[l]);
Execution for this program
C:\ > Sample My Home
Output of Example
Welcome to My Home
In Previous examples, we have used the Main method with no parameters. Notice that in the above example how the Main is declared.
Main is declared with a parameters args. The parameter args is an array of strings. Any arguments provided in the command line at the time of execution, are passed to the array args as its elements. We can access the array elements by using a subscript like args,args and so on.
Like as in the command line" C:\> Sample My Home", args[O] and args contains:
Args  <-- My
args  <-- Home
There fore the values will be display of these parameters in Console.Write() statement.