I am migrating an old application to a newer .NET-version. The current application stores arrays with user settings into the registry.
In the new application I want to change this mechanism into .NET Application settings (app.config), but I have only figured out so far how to store one-dimensional values in there, for example…
My.Settings.myName1 = "John Doe"
My.Settings.myMail1 = "john.doe@somemaildomain.com"
My.Settings.myName2 = "Lorem Ipsum"
My.Settings.myMail2 = "lorem.ipsum@somemaildomain.com"
I guess it is possible somehow to work not only with single values, but with arrays, too, which ideally could be accessed by a namespace, something like this:
REM just demo code to display what i want, no idea if something like this works...
My.Settings.myContacts(1).Name = "John Doe"
My.Settings.myContacts(1).Mail = "john.doe@somemaildomain.com"
My.Settings.myContacts(2).Name = "Lorem Ipsum"
My.Settings.myContacts(2).Mail = "lorem.ipsum@somemaildomain.com"
Is something similar possible? If not, is there another way how to work with multidimensional values / arrays in the .NET Application settings?
.NET app settings are key, value pair only.
If you want multidimensional values in app.config you should look at implementing your own custom config section.
See http://msdn.microsoft.com/en-us/library/2tw134k3.aspx