000: // CommandLine\cmdline1.cs 001: using System; 002: 003: public class CommandLine 004: { 005: public static void Main(string[] args) 006: { 007: Console.WriteLine("Number of command line parameters = {0}", args.Length); 008: for(int i = 0; i < args.Length; i++) 009: { 010: Console.WriteLine("Arg[{0}] = [{1}]", i, args[i]); 011: } 012: } 013: } |
Number of command line parameters = 3 Arg[0] = [A] Arg[1] = [B] Arg[2] = [C] |
000: // CommandLine\cmdline2.cs 001: using System; 002: 003: public class CommandLine2 004: { 005: public static void Main(string[] args) 006: { 007: Console.WriteLine("Number of command line parameters = {0}", args.Length); 008: foreach(string s in args) 009: { 010: Console.WriteLine(s); 011: } 012: } 013: } |
>cmdline2 John Paul Mary Number of command line parameters = 3 John Paul Mary |