Joseph Michael Pesch
VP Programming

C# Sample Iterating Enum

by 19. April 2010 16:11

using System;

 

namespace TempConsole

{

  class Program

  {

    enum DayOfWeek { Sunday = 1, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday };

 

    static void Main(string[] args)

    {

      Console.Title = "Sample Iterating Enum";

      foreach (DayOfWeek t in Enum.GetValues(typeof(DayOfWeek)))

      {

        Console.WriteLine(t.ToString() + " = " + (int)t);

      }

      Console.ReadKey();

    }

  }

}

Tags:

Excel

Comments are closed