How to initialize StringDictionary in my project settings

1.2k Views Asked by At

I've added a StringDictionary to my project settings in VS2010. When I try to add members to it in my program, I get a NullReferenceException. When I try to initialize a value in its Value column in my project settings, it says my entry cannot be converted to StringDictionary. I'm sure it's looking for some XML code, but isn't there a better way to initialize the StringDictionary before compilation?

Additional info:

  1. Go to Menu -> Project -> [Project Name]> Properties... -> Settings

  2. Add a setting named mySetting of type System.Collections.Specialized.StringDictionary

  3. In your code add a line [ProjectName].Properties.Settings.Default.mySetting.Add("key","value");

  4. Run and get the exception.

1

There are 1 best solutions below

0
user2320861 On

I ended up just using two ArrayList settings in place of the one Hashtable setting.