Created
May 7, 2013 07:55
-
-
Save phillip-haydon/5530960 to your computer and use it in GitHub Desktop.
This file contains 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
public static class Enums | |
{ | |
public static IList<dynamic> ListFrom<T>() | |
{ | |
var list = new List<dynamic>(); | |
var enumType = typeof(T); | |
foreach (var o in Enum.GetValues(enumType)) | |
{ | |
list.Add(new | |
{ | |
Name = Enum.GetName(enumType, o), | |
Value = o | |
}); | |
} | |
return list; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment