Currently, in my C# .cs file, I have declared a dictionary as such:
Dictionary<string, string> example_map = new Dictionary<string, string>();
option_symbol_map.Add("Key11", "Val1");
option_symbol_map.Add("Key2", "Val2");
option_symbol_map.Add("Key3", "Val3");
I need to move these keys and corresponding values to the app.config file so they can be edited as required.
Whats the best way to implement this?
Should I do it like this:
<add key="Test1" value="Key1,Key2,Key3"/>
<add key="Test2" value="Val1,Val2,Val3"/>
And then read both keys simultaneously while creating my dictionary?
or should I list it this way:
<add key="test3" value="Key1,Val1,Key2,Val2,Key3,Val3"/>
In this case how would I create my map, selecting every alternate object as key and value?
Instead of AppSettings you can write your own
ConfigurationElementCollectionclass that reads something like this:Here is an article that covers the most important parts. If you do this then you do not need to know the keys.