Mega Code Archive

 
Categories / C# Tutorial / Data Type
 

Converting an enumerated value to a string

using System; public class EnumSample {     enum Colors {Red = 1, Blue = 2};     public static void Main() {         Enum myColors = Colors.Red;         Console.WriteLine("The value of this instance is '{0}'",            myColors.ToString());     } }