C# (CSharp) DotNet.Config Namespace

Nested Namespaces

DotNet.Config.SampleUsage

Classes

Name Description
AppSettings This class uses a java style .properties file to load, apply ('glue'), and save settings. I've found this approach and helper class is far easier than using app.config for several reasons: 1) Non-technical folks have no problem editing .ini "name=value" style files, but they struggle with XML 2) Values with quotes in xml are a headache - you have to use '"' which gets messy 3) If you're writing a packaged dll, it needs to use the entry point's app.config which we don't control. Using this approach, you can ship a 'MyDll.config' 4) The 'glueOn' approach is really handy. It'll just stick values from the .properties file onto your class, regardless of whether they're public, private, or static. If you use a 'private static string _name' convention, it'll even take 'name=value' from the properties file (no underscore) and apply it 5) Saving settings back to app.config is a royal headache. Here, you just call Save(name, value) and it's done This class also takes into account loading the properties file from the same directory as the executing assembly, even when installed as a service, so you don't run into the issue of the current path being sys32 or whatever execution location services are started from.
TestAppSettings