20
1
using System;
2
3
public class Program
4
{
5
enum BallColor
6
{
7
White=0,
8
Red = 1,
9
Green = 2
10
}
11
public static void Main()
12
{
13
BallColor ballColor = BallColor.White;
14
//get Enum value using Enum.GetName()
15
var val=Enum.GetName(typeof(BallColor), ballColor);
16
17
//print it
18
Console.WriteLine("Enum value= "+val);
19
}
20
}
Cached Result
Enum value= White