Cinchoo – Reading Nested INI files, Part 2


In this section, I’ll talk about one of the most important feature Cinchoo framework provides in reading INI file is that the support of  Nested INI files. It gives the flexibility of breaking down large INI file into multiple small and manageable INI files. Here is how you can do it using Cinchoo framework,

Nested INI files can be setup as below

Main.ini file

;This is a test INI file.




In main.ini file, we included TestInclude.ini file using [INCLUDE] tag. Tag is case-sensitive. Also the path can specified as absolute/relative path.

TestInclude.ini file


Loading Main.ini file using ChoIniDocument.Load() will load all the included INI files and build the tree in memory seamlessly.

static void Main(string[] args)
    using (ChoIniDocument iniDocument = ChoIniDocument.Load(@"C:\Temp\TestIni1.ini"))

PS: Make sure all the main as well as included INI files contains distinct INI sections (no duplicate section allowed). Otherwise load will fails with exception.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s