Configuration.Ini
0.1.3
See the version list below for details.
dotnet add package Configuration.Ini --version 0.1.3
NuGet\Install-Package Configuration.Ini -Version 0.1.3
<PackageReference Include="Configuration.Ini" Version="0.1.3" />
<PackageVersion Include="Configuration.Ini" Version="0.1.3" />
<PackageReference Include="Configuration.Ini" />
paket add Configuration.Ini --version 0.1.3
#r "nuget: Configuration.Ini, 0.1.3"
#addin nuget:?package=Configuration.Ini&version=0.1.3
#tool nuget:?package=Configuration.Ini&version=0.1.3
INI configuration file

Simple INI parser and printer.
Getting started
Use the global using
directive for the whole project:
global using Configuration;
global using static Configuration.Prelude;
Or the using
directive in a single file:
using Configuration;
using static Configuration.Prelude;
Call Ini
function. Pass the IEqualityComparer<string>
that will be used to determine equality of keys in the configuration:
Result<Ini, string> result = Ini(new FileInfo("Configuration.ini"));
Result<Ini, string> result = Ini(new FileInfo("Configuration.ini"), StringComparer.OrdinalIgnoreCase);
Use Match()
function to extract configuration:
Ini ini = result.Match(ini => ini, err => throw new ApplicationException(err));
Initial Configuration.ini content:
[section_one]
# Comment
KeyOne = SectionOne_ValueOne
KeyTwo = SectionOne_ValueTwo
[section_two]
KeyOne = SectionTwo_ValueOne
KeyTwo = SectionTwo_ValueTwo
KeyThree = SectionTwo_ValueThree
[section_three]
KeyOne = SectionThree_ValueOne
KeyTwo = SectionThree_ValueTwo
Get value associated with the section
/key
combination:
Option<string> one_one = ini["section_one", "KeyOne"];
Option<string> two_two = ini["section_two", "KeyTwo"];
Option<string> three_three = ini["section_three", "KeyThree"];
Console.WriteLine(one_one); // Some(SectionOne_ValueOne)
Console.WriteLine(two_two); // Some(SectionTwo_ValueTwo)
Console.WriteLine(three_three); // None
Use IsSome
and IsNone
properties to check, if value
exists:
bool one_one_is_some = one_one.IsSome; // true
bool three_three_is_some = three_three.IsSome; // false
bool three_three_is_none = three_three.IsNone; // true
Use Match()
function, to extract value
:
string one_one_value = one_one.Match(some => some, "none"); // "SectionOne_ValueOne"
string three_three_value = three_three.Match(some => some, "none"); // "none"
Set Some()
to edit value
:
ini["section_one", "KeyOne"] = Some("SectionOne_ValueOne_Edited");
one_one = ini["section_one", "KeyOne"];
one_one_value = one_one.Match(some => some, "none"); // "SectionOne_ValueOne_Edited"
Set Some()
to add value
:
ini["section_one", "KeyThree"] = Some("SectionOne_ValueThree_Added");
Option<string> one_three = ini["section_one", "KeyThree"];
string one_three_value = one_three.Match(some => some, "none"); // "SectionOne_ValueThree_Added"
Set None
to remove value
:
ini["section_two", "KeyThree"] = None;
Option<string> two_three = ini["section_two", "KeyThree"];
string two_three_value = two_three.Match(some => some, "none"); // "none"
Set None
to remove section
:
ini["section_three"] = None;
Option<Section> three = ini["section_three"];
bool three_is_none = three.IsNone; // true
Write configuration to a file:
ini.WriteTo(new FileInfo("Configuration.ini"));
Final Configuration.ini content:
[section_one]
KeyOne = SectionOne_ValueOne_Edited
KeyTwo = SectionOne_ValueTwo
KeyThree = SectionOne_ValueThree_Added
[section_two]
KeyOne = SectionTwo_ValueOne
KeyTwo = SectionTwo_ValueTwo
Sample
See GettingStarted test.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.8
- Functional.Monad (>= 0.1.4)
- IndexRange (>= 1.0.3)
- IsExternalInit (>= 1.0.3)
-
.NETStandard 2.0
- Functional.Monad (>= 0.1.4)
- IndexRange (>= 1.0.3)
- IsExternalInit (>= 1.0.3)
-
net6.0
- Functional.Monad (>= 0.1.4)
-
net8.0
- Functional.Monad (>= 0.1.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.2.1 | 201 | 4/9/2025 |
0.2.0 | 163 | 4/9/2025 |
0.1.14 | 171 | 3/12/2025 |
0.1.13 | 172 | 3/11/2025 |
0.1.12 | 152 | 3/11/2025 |
0.1.11 | 158 | 3/10/2025 |
0.1.10 | 170 | 3/10/2025 |
0.1.9 | 133 | 3/9/2025 |
0.1.8 | 187 | 3/8/2025 |
0.1.7 | 213 | 3/6/2025 |
0.1.6 | 205 | 3/6/2025 |
0.1.5 | 209 | 3/5/2025 |
0.1.4 | 204 | 3/4/2025 |
0.1.3 | 200 | 3/4/2025 |
0.1.2 | 203 | 3/4/2025 |
0.1.1 | 194 | 3/3/2025 |
0.1.0 | 95 | 3/2/2025 |