Last active
May 1, 2018 19:19
-
-
Save Flayed/07b55a8495e064b8fb627fe8d637b440 to your computer and use it in GitHub Desktop.
Enum to Tuple
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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