< Day Day Up > |
TechniqueUse a string array as a parameter in your application's entry point, the static Main function. using System; namespace _2_CommandLineArgs { class Class1 { static void Main(string[] args) { foreach ( string arg in args ) Console.WriteLine( arg + "\n" ); } } } CommentsThe Main function in an application has the option of accepting a string array as a parameter. This array contains the command-line arguments passed to it by the system where each element in the array corresponds to a string on the command line delineated by quotation marks or whitespace. |
< Day Day Up > |