HOWTO: Read and Write the Registry to persist State

  • Thread starter Thread starter Dan Sikorsky
  • Start date Start date
D

Dan Sikorsky

Should application data be read and written to the Registry to persist
state, or should the App.config file be used?

If the Registry should be used, what .NET class reads and writes the
Registry?

If the App.config file should be used, reading a configuration setting is
trivial, but there appears to be no write methtod. Please post a write
method when replying.
 
Dan,

Check out the Registry class in the Microsoft.Win32 namespace. It will
allow you to read/write the registry with relative ease.

A better solution to writing configuration access code would be to take a
look at the Configuration Management Access Block for .NET which is apart of
the "Patterns & Practices" section of MSDN.

For more information:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/
cmab.asp

Patrick Altman
 

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

Back
Top