Using foreach to loop through the parameter from Main function : Main « Language Basics « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("{0} command line arguments were specified:",args.Length);
            foreach (string arg in args)
                Console.WriteLine(arg);
        }
    }








1.4.Main
1.4.1.The Main Function
1.4.2.The Main Function: use foreach to loop through command-line parameters
1.4.3.The main function: returning an int status
1.4.4.Main Entry Point
1.4.5.Looking for Command-Line Options
1.4.6.Looking for Command-Line Options (Simplified)
1.4.7.Using foreach to loop through the parameter from Main function