I'm trying to avoid hardcoding in a .net 2.0 soon to be 3.5 application.
I have a large enumeration which I wish to map 1 to 1 to a set of strings. Each enumerated value will also map to 1 of 2 values indicating an action. The existing code does this with a big switch statement but this seems ugly to me.
Is there a better way of storing and accessing the data?
I've thought about resx files but when you consider that the designer file contains just as many hardcoded values it seems a little pointless.
Is embedding an xml file in the assembly a good idea?
Is a big switch statement not as bad as it seems?
Is there a better solution?
Despite how ugly a switch statement is its the most efficient way to map enums to strings. Embedding an XML file will just bloat the size of your assembly and it will take much longer to get the string value you need.