1.2 Parsing Command-Line Arguments

 <  Day Day Up  >  

You want your application to support command-line argument parsing.


Technique

Use 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" );         }     } } 

Comments

The 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  >  


Microsoft Visual C# .Net 2003
Microsoft Visual C *. NET 2003 development skills Daquan
ISBN: 7508427505
EAN: 2147483647
Year: 2003
Pages: 440

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net