Nager.KeyValueParser
1.1.0
Prefix Reserved
dotnet add package Nager.KeyValueParser --version 1.1.0
NuGet\Install-Package Nager.KeyValueParser -Version 1.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Nager.KeyValueParser" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Nager.KeyValueParser" Version="1.1.0" />
<PackageReference Include="Nager.KeyValueParser" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Nager.KeyValueParser --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Nager.KeyValueParser, 1.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Nager.KeyValueParser@1.1.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Nager.KeyValueParser&version=1.1.0
#tool nuget:?package=Nager.KeyValueParser&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Nager.KeyValueParser
Nager.KeyValueParser is a lightweight and efficient library for parsing key-value pairs from strings. Its flexible design supports various delimiters and provides an easy-to-use API.
Features
- Support for custom delimiters
- High performance with low memory usage
- Easy integration into .NET projects
Installation
The package is available on nuget
PM> install-package Nager.KeyValueParser
or
dotnet add package Nager.KeyValueParser
Usage
using Nager.KeyValueParser;
// Example: Parsing key-value pairs using `;` as the pair delimiter and `=` as the key-value separator
var parser = new MemoryEfficientKeyValueParser(';', '=');
var input = "key1=value1;key2=value2";
if (parser.TryParse(input, out var result))
{
foreach (var kvp in result)
{
Console.WriteLine($"{kvp.Key}: {kvp.Value}");
}
}
else
{
Console.WriteLine("Failed to parse the input string.");
}
Benchmark
| Method | Job | Toolchain | IterationCount | LaunchCount | WarmupCount | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
|---|---|---|---|---|---|---|---|---|---|---|---|
| TestMemoryEfficientKeyValueParser | DefaultJob | Default | Default | Default | Default | 179.6 ns | 1.72 ns | 1.61 ns | 0.0801 | 0.0002 | 1008 B |
| TestStringSplitKeyValueParser | DefaultJob | Default | Default | Default | Default | 232.7 ns | 3.29 ns | 3.08 ns | 0.1116 | 0.0005 | 1400 B |
| TestMemoryEfficientKeyValueParser | MediumRun | InProcessNoEmitToolchain | 15 | 2 | 10 | 190.2 ns | 2.54 ns | 3.73 ns | 0.0801 | 0.0002 | 1008 B |
| TestStringSplitKeyValueParser | MediumRun | InProcessNoEmitToolchain | 15 | 2 | 10 | 240.0 ns | 1.52 ns | 2.23 ns | 0.1116 | 0.0005 | 1400 B |
License
This project is licensed under the MIT License. See the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Nager.KeyValueParser:
| Package | Downloads |
|---|---|
|
Nager.EmailAuthentication
Email Authentication, DMARC Record Validation, DKIM Record Validation, DKIM Signature Validation, SPF |
GitHub repositories
This package is not used by any popular GitHub repositories.