I have an application that requires mappings between string values, so essentially a container that can hold key values pairs. Instead of using a dictionary or a name-value collection I used a resource file that I access programmatically in my code. I understand resource files are used in localization scenarios for multi-language implementations and the likes. However I like their strongly typed nature which ensures that if the value is changed the application does not compile.
However I would like to know if there are any important cons of using a *.resx file for simple key-value pair storage instead of using a more traditional programmatic type.
There are two cons which I can think of out of the blue:
BTW. Couldn’t you just create helper class or structure containing properties, like that:
You can then access these properties exactly the same way, as resource files (I am assuming that you’re used to this style):
Maybe it is not the best thing to do, but I firmly believe this is still better than using resource file for that…