AppSettings

G

Guest

I can retrieve a value from the appSettings section of my app.config file for
a Windows application (VS 2003) but is there a way to write to this file,
updating a value?

I want to store a value which may increment from time to time, and need the
value to be retained between closing the application and starting it again.

Or should I just write it to a normal text file instead?
 
N

Nicholas Paldino [.NET/C# MVP]

My general rule of thumb for app config files is to store values in
there that will be constant throughout the lifetime of an instance of the
app running. If something is bound to change during the course of the app,
then this is not the place to put it.

In .NET 1.1 and before, you had to load the config file with the Xml
classes and modify the file yourself.

In .NET 2.0 and above, you can use the classes in the
System.Configuration namespace to modify certain values and to save them
back to the config file.

Hope this helps.
 
J

jibesh

why dont you think of a Singleton class contains a HashTable, and Create a
XML schema ,
read and write your data anywhere from your application

- Jibesh.V.P
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top