Skip to content

Instantly share code, notes, and snippets.

@Flayed
Last active May 1, 2018 19:19
Show Gist options
  • Save Flayed/07b55a8495e064b8fb627fe8d637b440 to your computer and use it in GitHub Desktop.
Save Flayed/07b55a8495e064b8fb627fe8d637b440 to your computer and use it in GitHub Desktop.
Enum to Tuple
private IEnumerable<(string key, int value)> GetEnum(Type enumType)
{
return Enum.GetValues(enumType)
.Cast<int>()
.Select(e => (Enum.GetName(enumType, e), e));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment