Cercando non mi ricordo più dove, mi sono imbattuto in questo progetto, che in pratica permette di accedere in lettura/scrittura a file di configurazione di qualsiasi tipo in modo immediato e  flessibile.

Due parole prese direttamente dal manuale:

Nini is an uncommonly powerful .NET configuration library designed to help build highly configurable applications quickly. Nini provides a solution that attempts to eliminate the above problems. It provides a large feature set that gives you functionality that you will use in every phase of your project, from concept to mature product.  This is accomplished through a simple, yet flexible, API that provides an abstraction over the underlying configuration sources.  It solves all of the problems that I described above.  We’ll see how this is done in the examples below.

A Simple Example

In order to show you how Nini solves these problems let’s go over an example.  First, let’s take an example configuration file.  I will choose the INI format for most of the examples in this manual. INI files are a tried and true configuration file type used in well known open source projects such as MySQL, PHP, and Samba. In fact, Nini has support for several INI file types. They are very simple and easy to edit so they remain a very popular choice. Nini contains it's own INI parser class ( IniDocument) which is written entirely in C# with no Windows API code so it's cross platform. Here is the text of MyApp.ini for this example:

[Logging]
File Name = MyApp.log
MessageColumns = 5
MaxFileSize = 40000000000000
Below is a C# example piece of code that describes how to access the configuration data from the INI file from the file above: 
using Nini.Config;

IConfigSource source = 
new IniConfigSource("MyApp.ini");

string fileName = source.Configs["Logging"].Get("File Name");
int columns = source.Configs["Logging"].GetInt("MessageColumns");
long fileSize = source.Configs["Logging"].GetLong("MaxFileSize");
Here is the example in VB:
Imports Nini.Config

Dim source As New IniConfigSource("MyApp.ini")

Dim fileName As String = source.Configs("Logging").Get("File Name")
Dim columns As Integer = source.Configs("Logging").GetInt("MessageColumns")
Dim fileSize As Long = source.Configs("Logging").GetLong("MaxFileSize")

... Sembra interessante

link:Nini: An uncommonly powerful .NET configuration library

 

powered by IMHO 1.2