Accessing hard-coded data in a C# application.
- by haymansfield
I'm trying to avaid hardcoding in a .net 2.0 soon to be 3.5 application.
I have a large enumneration 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?