I'm writting a multi-lingual application that uses many enums, and I'd like to achieve the following objectives:
- Display Enum names as localized strings
- Provide localized descriptions using attributes
- Enable language sensitive parsing of enums back to int values
I'm keen to to decorate the enum using attributes + a resource file, such that the localized strings can be reached from run-time type info. I've been down the route before of declaring a static class with static members instead of an enum, but this presented as many problems as it solved.
Is some sort of a TypeDescriptor based mechanism appropriate? Or even possible?
Moreover - how does one accomplish goal #3 in a clean, generic, re-usable manner?
Since asking this question, I've completed the open source library that needed localizable enum displays. I went with the technique of implementing TypeConverters. Full source available at http://measures.codeplex.com/