using System;
public class Program
{
enum BallColor
White=0,
Red = 1,
Green = 2
}
public static void Main()
string value = "Red";
// Try to convert the string to an enum.
BallColor ball = (BallColor)Enum.Parse(typeof(BallColor), value);
// Check if value matches
if (ball == BallColor.Red)
Console.WriteLine("Ball Color is Red");