/ Published in: C#
Examples of converting from a string to an enum value and back
- //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);
You need to login to post a comment.