Return to Snippet

Revision: 3647
at August 28, 2007 14:32 by elugardo


Initial Code
//convert enum to string. mode is an Enum of type PageModeEnum. 
//Enum.GetName returns the name the mode is set to
Enum.GetName( typeof(PageModeEnum), mode)

//convert a string to an emum.
//buttonState is the string
//ButtonState is the enum type
(ButtonState)Enum.Parse(typeof(ButtonState);, buttonState, true);

Initial URL

                                

Initial Description
Examples of converting from a string to an enum value and back

Initial Title
Enum to string and string to enum

Initial Tags

                                

Initial Language
C#