INI Files in .NET

This simple class (IniFile) brings the ease of using INI files into the .NET Framework.

When .NET came into the programming scene, the mainstream for hard disk data storage moved from using INI files to using XML files. This was because .NET provided millions of ways for XML manipulation, but not for INI files. This class brings INI files back to the .NET Framework with use in C#, VB.NET, etc.


  • Easily save and load data from INI files.
  • Indexer property get and setters.
  • Many overloaded helper functions to make life easier.
  • Perfect for configuration files.
  • Default value options for fast retrieval of settings.
  • Complete inline documentation.

// Create the INI file
IniFile ini = new IniFile("data.ini");
// Set the values
ini.Write("Header", "Title","Hello!");
ini.Write("Header", "Height", 480);
ini.Write("Header", "Full", false);
// Get some values from the ini file
int height = ini.GetInteger("Header", "Height");
// Get the width, with a default value to 640
int width = ini.Get("Header", "Width", 640);
// Using the indexer gets and sets:
"Title: " + ini["Header", "Title"]
ini["Header2", "Author"] = "Rob Loach";

IniFile.cs14.92 KB