home | software | utility classes | user settings persistence
User settings can be stored in various places in .NET. Traditionally, developers would use the registry, or a custom settings file. The IsolatedStorage facility in .NET should not be overlooked for this task. It is accessed via a stream (meaning any serializable object may be written/read) and stored data follows the user via their roaming profile. In secure environments, it may only be accessed by authorised users, and the isolation level can be configured (by user, assembly, domain).
Here we have a simple class designed to simplify the storage and retrieval of basic settings objects, be they strings, numeric values or serializable structures. These objects are keyed by strings, and these strings are used as file names within the roaming profile data. On my system, these files are tucked away here:
You can read more about Isolated Storage.
An example usage, showing a simple case:
Please feel free to provide feedback on this class . Bug reports are most appreciated when accompanied by a failing NUnit test case.
Authored by Drew Noakes, February 2005. Use freely, though keep this message in the source intact and report any bugs to me. I also appreciate seeing extensions, or simply hearing that you're using these classes. You may not copyright this work, though may use it in commercial/copyrighted works. Happy coding.