Crash893 Crash893 - 1 month ago 28
C# Question

Store Dictionary<string,string> in application settings

I have a dictionary of strings that i want the user to be able to add/remove info from then store it for them so it they can access it the next time the program restarts

I am unclear on how i can store a dictionary as a setting. I see that under system.collections.special there is a thing called a stringdictionary but ive read that SD are outdated and shouldn't be used.

also in the future i may have need to store a dictionary that is not strings only (int string)

how would you store a dictionary in the settings file for a .net application?

Answer

The simplest answer would be to use a row & column delimiter to convert your dictionary to a single string. Then you just need to store 1 string in the settings file.