No description, website, or topics provided.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

DynamicConfig README


DynamicConfig is a very simple to use configuration library based on the C# 4.0 dynamic feature. It allows loading from file (or parsing) multiple configurations that can be later accessed via dynamic typing, no custom classes or casts are required. If a configuration was loaded from file, updating a property will result in the original file to be updated.

DynamicConfig is somewhat based on JsonConfig ( ) but uses Newtonsoft.JSON instead of JsonFX


The main entry-point of the library is the DynamicConfig.Config class from which you can access all the exposed functionalities. The first thing to do is to register a provider, at the moment there is a JsonConfigProvider included, so:

	var provider = new Providers.JsonConfigProvider();
	Config.RegisterProvider("json", provider);

Providers can be retrieved using the GetProvider method:

	var jsonProvider = Config.GetProvider("json");

Loading data

Then you can load a configuration from file directly via the DynamicConfig.Config class

	var providerName = "json";
	var configName = "myConfig";
	dynamic config = Config.Load(providerName, configName, filename);

or via the Provider:

	var jsonProvider = Config.GetProvider("json");
	var configName = "myConfig";
	dynamic config = jsonProvider.Load(configName, filename);

configurations can be accessed using dynamic typing on the Provider:

Accessing data

	var jsonProvider = Config.GetProvider("json");
	var foo =;
	Console.Writeline("foo: {0}", foo);


configurations can include also complex objects:

	var json = "{name:\"John\", complex:{ one: 1, two: 2, three: \"three\" } }";
	var jsonProvider = Config.GetProvider("json");
	var configName = "myConfig";
	jsonProvider.Parse(configName, json);
	var three = jsonProvider.myConfig.complex.three;
	Console.Writeline("three: {0}", three);

Incoming Features/Upgrades

  • monitor config file changes on filesystem to force config reload
  • provider options (eg. readonly)
  • Async
  • appSettings Provider


  • better error checking (eg. while saving)