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.
Features
Example
// 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:
Console.WriteLine(
"Title: " + ini["Header", "Title"]
);
ini["Header2", "Author"] = "Rob Loach";
| Attachment | Size |
|---|---|
| IniFile.cs | 14.92 KB |