Simple configuration manager to get and set the values in the AppSettings section of the default configuration file (C# - Source file).
Note: this nuget package contains csharp source code and depends on Generics introduced in .Net 2.0.
You can install using NuGet, see SimpleHelpers.ConfigManager at NuGet.org
PM> Install-Package SimpleHelpers.ConfigManager
The nuget package contains C# source code.
The source code will be installed in your project with the following file system structure:
|-- <project root>
|-- SimpleHelpers
|-- ConfigManager.cs
If you prefer, you can also download the source code: ConfigManager.cs
// setup (called once in application initialization)
// set to add any new keys added during the application execution
ConfigManager.AddNonExistingKeys = true;
string address = ConfigManager.Get ("MongoDBaddress", "localhost");
int port = ConfigManager.Get ("MongoDBport", 21766);