Program namesarray.cs

Demonstrates use of foreach loop to traverse an array 


using System;

class Program {
    
    static void Main(string[] args) {

        string[] names = {"Zoey","Bryan","Beth","Carl","Glenda","Eric",
                "Frank","Gary","David","Hubert","Helga","Mike",
                "Sarah","Allan"};

        foreach (string name in names) {

            Console.WriteLine("\t{0}", name);

        }

        Console.Write("\n\tTo exit program, press the Enter key... ");
        Console.ReadLine();
    }

}