Skip to content

Instantly share code, notes, and snippets.

@jacbar
Last active December 15, 2015 06:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacbar/5220700 to your computer and use it in GitHub Desktop.
Save jacbar/5220700 to your computer and use it in GitHub Desktop.
public static Dictionary<int,string> EnumToDictionary(Type type)
{
// all translations are in file Enums.resx key => enum attribute name
ResourceManager rm = new ResourceManager(typeof(Enums));
return Enum.GetValues(type).Cast<int>().ToDictionary(e => e, e => rm.GetString(Enum.GetName(type, e)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment