views:

222

answers:

4

I am using the .NET Compact Framework 3.5 and I am trying to determine if there is a standard way to store settings that a user to change in my application. I am aware of the Compact 3.5 SQL database, but I am trying to avoid that if I can to avoid a dependency that is not already installed on the user’s mobile device (I already have to worry about the 3.5 .NET Framework so I am trying to avoid any other dependencies if I can).

I saw that the old .config file (via System.Configuration.ConfigurationSettings.AppSettings) is obsolete and doesn’t appear to be supported on the Compact framework anyway.

Aside from stuffing it in an xml file stored in /Application Data/My App/ and parsing it, are there any built in libraries for this type of functionality?

I am not seeing much online or on this site about this. Mostly non-compact framework solutions.

A: 

OpenNetCF has support for loading and saving settings to an xml file

OpenNetCF.AppSettings namespace, and the SettingsFile class should do the trick :)

Matt
+1  A: 

I use the registry for many settings in my application. We created a wrapper around registry calls that handle exceptions, memory cleanup, etc. After that, it works pretty well. I guess that all depends on what kind of settings you are talking about.

Bryan
A: 

Another fallback option is good old fashioned .INI files. There's a number of pure C# classes out there for parsing them and using the values. Simple and straightforward.

markerikson
A: 

I actually ended up using System.Xml.Serialization.XmlSerializer. This allowed us to store and restore settings with little effort. It is tolerant of changes to the settings when doing an upgrade/downgrade.

borq