Converting from a string to an enum option

If you need to convert a string to an enum option, you can convert it using the Enum.Parse() method:

Day weekday = (Day) Enum.Parse(typeof(Day), "Wednesday", true);
Posted on 01 Sep 05 by Helen Emerson (last updated on 01 Sep 05).
Filed under .NET