Soenneker.Enumerables.CommaSeparated
11.0.34
Prefix Reserved
dotnet add package Soenneker.Enumerables.CommaSeparated --version 11.0.34
NuGet\Install-Package Soenneker.Enumerables.CommaSeparated -Version 11.0.34
<PackageReference Include="Soenneker.Enumerables.CommaSeparated" Version="11.0.34" />
<PackageVersion Include="Soenneker.Enumerables.CommaSeparated" Version="11.0.34" />
<PackageReference Include="Soenneker.Enumerables.CommaSeparated" />
paket add Soenneker.Enumerables.CommaSeparated --version 11.0.34
#r "nuget: Soenneker.Enumerables.CommaSeparated, 11.0.34"
#:package Soenneker.Enumerables.CommaSeparated@11.0.34
#addin nuget:?package=Soenneker.Enumerables.CommaSeparated&version=11.0.34
#tool nuget:?package=Soenneker.Enumerables.CommaSeparated&version=11.0.34
Soenneker.Enumerables.CommaSeparated
Enumerates simple comma-delimited text as trimmed ReadOnlySpan<char> tokens without allocating a string or array for each value.
Install
dotnet add package Soenneker.Enumerables.CommaSeparated
Enumerate values
using Soenneker.Enumerables.CommaSeparated;
ReadOnlySpan<char> input = "alpha, beta, ,gamma";
foreach (ReadOnlySpan<char> token in new CommaSeparatedEnumerable(input))
{
// token is "alpha", then "beta", then "gamma"
Process(token);
}
Leading and trailing whitespace is trimmed from each token. Empty entries—including whitespace-only entries—are skipped. A null string constructor argument behaves like an empty input.
Parse without intermediate strings
Many framework parsing APIs accept spans directly:
var values = new CommaSeparatedEnumerable("10, 20, 30");
var total = 0;
foreach (ReadOnlySpan<char> value in values)
total += int.Parse(value);
int count = values.Count(); // 3
Count() scans the input independently; it does not cache tokens. Calling it and then enumerating performs two passes.
Boundaries
This is not a CSV parser. Commas always delimit values, and quoting, escaped commas, embedded records, and alternate separators are not supported. Use a CSV library when inputs can contain those features.
Both the enumerable and enumerator are ref struct types. They cannot be boxed, stored on the heap, used across await or yield, or exposed as IEnumerable<T>. Each Current span points into the original input; call ToString() if a token must outlive that input or the current synchronous scope.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Soenneker.Enumerables.CommaSeparated:
| Package | Downloads |
|---|---|
|
Soenneker.Extensions.Type
An extension library for useful Type operations |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.34 | 2,534 | 11/11/2026 |
| 11.0.33 | 15,800 | 10/26/2026 |
| 4.0.32 | 8,251 | 10/14/2026 |
| 4.0.31 | 958 | 10/14/2026 |
| 4.0.29 | 844 | 10/13/2026 |
| 4.0.26 | 1,000 | 10/12/2026 |
| 4.0.25 | 156 | 10/12/2026 |
| 4.0.24 | 4,833 | 10/11/2026 |
| 4.0.23 | 16,580 | 9/24/2026 |
| 4.0.22 | 7,997 | 9/15/2026 |
| 4.0.21 | 8,779 | 9/12/2026 |
| 4.0.20 | 29,242 | 8/30/2026 |
| 4.0.19 | 119 | 8/29/2026 |
| 4.0.18 | 267 | 8/29/2026 |
| 4.0.17 | 30,125 | 7/27/2026 |
| 4.0.16 | 11,066 | 7/16/2026 |
| 4.0.15 | 17,900 | 6/19/2026 |
| 4.0.14 | 20,072 | 6/5/2026 |
| 4.0.13 | 868 | 6/5/2026 |
| 4.0.12 | 23,067 | 4/22/2026 |
Upgrade .NET 11 release candidates to stable