Reading Enum in C#

  1. using System;  
  2. namespace ReadingEnum  
  3. {  
  4.       class EnumReader  
  5.       {  
  6.             static void Main(string[] args)  
  7.             {  
  8.                   Console.WriteLine("Hello,I am going to read all values of System.ConsoleColor enum.");  
  9.                   Console.WriteLine("*******************************************************************");  
  10.                   foreach (ConsoleColor c in Enum.GetValues(typeof(ConsoleColor)))  
  11.                   {  
  12.                         Console.ForegroundColor = c;  
  13.                         Console.WriteLine("\tHello --- I am " + c.ToString());  
  14.                   }  
  15.                   Console.WriteLine("*******************************************************************");  
  16.                   Console.ReadLine();  
  17.             }  
  18.       }  
  19. }