Please note that a revised version of this code is now located here .
I wanted to create a self-contained (I’ll explain what I mean by this later) and re-usable template class that I could add to any C# application for the purpose of saving and loading application settings (user preferences, path names, etc.) in XML.
My goal was to be able to add new properties to the class without having to write additional code to have them load. This way, I would only need to add the necessary private variable and the associated public property (e.g. get & set) for each new applicatoin setting.
Yes, I know that .NET 2.0 and Visual Studio 2005 have a similar function built in, but I prefer to have full control of my application. Also I wanted to customize an event that could notify my application if/when the settings did not save or were not loaded successfully.
I wanted the class to be “self-contained”, that is, I wanted all of the code necessary to load and save the settings built into the class. That way, I could just add the appSettings class to my project and go.
This solution uses XML Serialization to store my application settings in an XML document. On retrieval, in the Load Continue reading ‘C# Application Settings Utility Class’
Recent Comments