SharpConfig 4.0.0
SharpConfig
Easy to use cfg / ini configuration library for .NET.
You can use SharpConfig to read, modify and save configuration files and streams, in either text or binary format.
Minimalistic, fully portable (.NET Standard 2.0), zero package dependencies.
Install
- .NET CLI:
> dotnet add package sharpconfig - Package Manager:
> NuGet\Install-Package sharpconfig - Download latest
Example
# An example configuration:
[General]
# a comment
SomeString = Hello World!
SomeInteger = 10 # an inline comment
SomeFloat = 20.05
SomeBoolean = true
SomeArray = { 1, 2, 3 }
Day = Monday
[Person]
Name = Peter
Age = 50
To read these values, your C# code would look like:
var config = Configuration.LoadFromFile("sample.cfg");
var section = config["General"];
string someString = section["SomeString"].StringValue;
int someInteger = section["SomeInteger"].IntValue;
float someFloat = section["SomeFloat"].FloatValue;
bool someBool = section["SomeBoolean"].BoolValue;
int[] someIntArray = section["SomeArray"].IntValueArray;
string[] someStringArray = section["SomeArray"].StringValueArray;
DayOfWeek day = section["Day"].GetValue<DayOfWeek>();
// Entire user-defined objects can be created from sections and vice versa.
var person = config["Person"].ToObject<Person>();
// ...
Documentation
The full documentation is available on the website.
Showing the top 20 packages that depend on SharpConfig.
| Packages | Downloads |
|---|---|
|
aliyun-net-sdk-core
Alibaba Cloud SDK for C#
|
3 |
|
aliyun-net-sdk-core
Alibaba Cloud SDK for C#
|
2 |
|
aliyun-net-sdk-core
Alibaba Cloud SDK for .NET
|
2 |
|
aliyun-net-sdk-core
Alibaba Cloud SDK for C#
|
1 |
Major version 4.0.0 includes breaking changes:
- Nullable reference types enabled across the API.
- Deprecated StringRepresentation (use SaveToString).
- Removed legacy Setting.StringValueTrimmed.
- Optimized performance and added multiline value support.
For the full changelog, see the project URL.
.NET 10.0
- No dependencies.
.NET Standard 2.0
- No dependencies.
| Version | Downloads | Last updated |
|---|---|---|
| 4.0.0 | 1 | 03/28/2026 |
| 3.2.9.1 | 0 | 05/20/2020 |
| 3.2.9 | 0 | 05/19/2020 |
| 3.2.8 | 0 | 04/09/2018 |
| 3.2.6.1 | 0 | 03/08/2018 |
| 3.2.6 | 0 | 03/04/2018 |
| 3.2.5 | 0 | 12/12/2017 |
| 3.2.4 | 0 | 12/11/2017 |
| 3.2.3 | 0 | 12/07/2017 |
| 3.2.1 | 0 | 12/06/2017 |
| 3.2.0 | 0 | 07/07/2017 |
| 3.1.0 | 0 | 03/31/2017 |
| 3.0.1 | 0 | 12/05/2016 |
| 3.0.0 | 1 | 03/28/2026 |
| 2.1.0 | 0 | 11/07/2016 |
| 2.0.1 | 0 | 09/05/2016 |
| 2.0.0 | 0 | 08/21/2016 |
| 1.5.6 | 0 | 07/12/2016 |
| 1.5.5 | 0 | 06/01/2016 |
| 1.5.4 | 1 | 03/28/2026 |
| 1.5.3 | 0 | 04/11/2016 |
| 1.5.2 | 1 | 03/28/2026 |
| 1.5.1 | 0 | 03/04/2016 |
| 1.5.0 | 1 | 03/28/2026 |
| 1.4.9 | 1 | 03/28/2026 |
| 1.4.8 | 0 | 12/04/2015 |
| 1.4.7 | 0 | 11/30/2015 |
| 1.4.6 | 0 | 11/29/2015 |
| 1.4.4 | 0 | 08/28/2015 |
| 1.4.3 | 0 | 03/31/2015 |
| 1.4.2 | 0 | 01/31/2015 |
| 1.4.1 | 0 | 01/30/2015 |
| 1.4.0 | 0 | 09/26/2014 |
| 1.3.0 | 0 | 10/30/2013 |
| 1.2.0 | 0 | 10/29/2013 |