Writing to a configuration file

  • Thread starter Thread starter FireStarter
  • Start date Start date
F

FireStarter

I know how to read from an application configuration file, by using
System.Configuration.AppSettingsReader.
This object does not allow writing a value back though. Does anybody
know how to do this?

The application is Windows Forms.




Thanks.

FireStarter.
 
Load the file into an XmlDocument and make the changes, then save the
changes.
 
Thank you, Peter. I just thought that the framework would provide a
wrapper class for writing, since it provides one for reading.
An AppSettings class with two main methods, .Read(string key) and
..Write(string key, string value) would have made sense, if you ask me.

Well, I'll just have to write my own :)


Thanks again.
 
A Microsoft group just released a never version of the application blocks,
called enterprise blocks:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/entlib.asp

If you are not opposed to using them (bit of a learning curve) you can get a
patch and new extensions from:
http://www.gotdotnet.com/workspaces....aspx?id=295a464a-6072-4e25-94e2-91be63527327

One of the extensions is to read/write to your app config.

--
Thanks
Wayne Sepega
Jacksonville, Fl


"When a man sits with a pretty girl for an hour, it seems like a minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein
 
Back
Top