Skip to content

Instantly share code, notes, and snippets.

@JamesMaroney
Created October 27, 2011 14:31
Show Gist options
  • Save JamesMaroney/1319699 to your computer and use it in GitHub Desktop.
Save JamesMaroney/1319699 to your computer and use it in GitHub Desktop.
get enum val by string
fileType = Enum.Parse(typeof(ArtifactStore.ArtifactFileType), fileExtension.ToUpper());
fileType = Enum.GetValues(typeof (ArtifactStore.ArtifactFileType))
.Cast<ArtifactStore.ArtifactFileType>()
.Where(m => m.ToString() == fileExtension.ToUpper()).SingleOrDefault();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment