Skip to content

Instantly share code, notes, and snippets.

@phillip-haydon
Created May 7, 2013 07:55
Show Gist options
  • Save phillip-haydon/5530960 to your computer and use it in GitHub Desktop.
Save phillip-haydon/5530960 to your computer and use it in GitHub Desktop.
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