views:

23

answers:

1

hello,

I'm trying to find out what my choices are when I'm going to use user (persistent) settings.

In vs Studio this is possible in the properties of your project but I'm getting to know the limits there:

  • Only values are allowed that can be converted to string.

  • Collections (e.g items in a Listbox, with a name and value) cannot be saved.

What I would like to know, how do you implement user settings with collections, and how do you make user settings?

Emerion

+3  A: 

If I understand correctly I think you're probably looking for serialization, and since you mention values that can't be converted to string I assume that you'd probably want binary serialization.

The System.Runtime.Serialization namespace contains classes to help you with this and here's an article that might be useful: Serialization in the .NET Framework

ho1
My question is, How do I keep user settings persistent without the use of the VS studio's properties. Serialization is one way to do it, I guess. Are there more ways?
Emerion
@Emerion: That's quite a big question, you could store them in files (.config files, custom XML files, .ini files, custom binary files etc), in the registry, in databases. It depends a lot on what data you need to store and what control you have over the machine etc and if all settings should be per user or if some should be shared.
ho1
Nice answer, thanks! I think I'm going with .ini file for my project as it's more of personal use. Was just curious ;) Points coming up!
Emerion