Skip to content

Instantly share code, notes, and snippets.

@lks128
Created December 25, 2012 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lks128/4373730 to your computer and use it in GitHub Desktop.
Save lks128/4373730 to your computer and use it in GitHub Desktop.
// Получение значения Enum по строковому имени
//
EnumType dp = EnumType.None;
if(Enum.IsDefined(typeof(EnumType), enumElementName))
dp = (EnumType)Enum.Parse(typeof(EnumType), enumElementName);
else
Console.WriteLine("Sorry, no element exists!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment