Soenneker.Extensions.Enumerable.String
4.0.1428
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Extensions.Enumerable.String --version 4.0.1428
NuGet\Install-Package Soenneker.Extensions.Enumerable.String -Version 4.0.1428
<PackageReference Include="Soenneker.Extensions.Enumerable.String" Version="4.0.1428" />
<PackageVersion Include="Soenneker.Extensions.Enumerable.String" Version="4.0.1428" />
<PackageReference Include="Soenneker.Extensions.Enumerable.String" />
paket add Soenneker.Extensions.Enumerable.String --version 4.0.1428
#r "nuget: Soenneker.Extensions.Enumerable.String, 4.0.1428"
#:package Soenneker.Extensions.Enumerable.String@4.0.1428
#addin nuget:?package=Soenneker.Extensions.Enumerable.String&version=4.0.1428
#tool nuget:?package=Soenneker.Extensions.Enumerable.String&version=4.0.1428
Soenneker.Extensions.Enumerable.String
Joining, filtering, case-insensitive searching, casing, deduplication, and compound-ID projection extensions for string sequences.
Installation
dotnet add package Soenneker.Extensions.Enumerable.String
Join values
using Soenneker.Extensions.Enumerable.String;
string csv = new[] { "red", "green", "blue" }
.ToCommaSeparatedString(includeSpace: true);
// red, green, blue
string path = new[] { "api", "customers", "42" }
.ToSeparatedString('/');
// api/customers/42
Both methods return an empty string for a null or empty source. A null item is represented as an empty field, so new[] { "a", null, "b" } joined with commas becomes a,,b. Joining is immediate and visits the source once.
ToSeparatedStringFormattable() is the allocation-conscious overload for value types implementing ISpanFormattable; it avoids the boxing that the unconstrained overload can require. Formatting uses the type’s default format with a null format provider.
Search strings
string[] names = ["Alpha", "Beta"];
names.ContainsAPart("PH"); // true; ignores case by default
names.ContainsAPart("PH", false); // false; ordinal, case-sensitive
names.ContainsIgnoreCase("alpha"); // true
names.StartsWithIgnoreCase("al"); // true
names.EndsWithIgnoreCase("TA"); // true
Searches are ordinal, skip null elements, stop at the first match, and do not allocate normalized copies. ContainsAPart() returns false for a null source or null/empty search text. The other search methods require non-null source and search arguments. An empty prefix or suffix matches when the sequence contains at least one non-null string.
Filter, normalize, and deduplicate
IEnumerable<string?> optionalValues = ["Alpha", null, " ", "alpha"];
IEnumerable<string> nonEmpty = optionalValues.ExceptNullOrEmpty();
IEnumerable<string> nonBlank = optionalValues.ExceptNullOrWhiteSpace();
IEnumerable<string> values = nonBlank;
IEnumerable<string> lower = values.ToLower();
IEnumerable<string> distinct = values.DistinctIgnoreCase();
HashSet<string> set = values.ToHashSetIgnoreCase();
These sequence-returning operations are lazy except ToHashSetIgnoreCase(), which materializes a new ordinal case-insensitive set. ExceptNullOrEmpty() preserves whitespace-only strings; ExceptNullOrWhiteSpace() removes them. ToLower() and ToUpper() use invariant casing and turn null elements into empty strings. DistinctIgnoreCase() skips nulls, keeps the first casing encountered, and preserves order.
Split compound IDs
List<(string PartitionKey, string DocumentId)> ids = new[]
{
"customer-42:order-100",
"standalone"
}.ToSplitIds();
// ("customer-42", "order-100")
// ("standalone", "standalone")
Each ID is split at its last colon, so earlier colons remain part of a compound partition key. The result is immediately materialized in source order. Null or empty IDs are rejected by the underlying split operation.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Soenneker.Extensions.Enumerable (>= 4.0.658)
- Soenneker.Extensions.Spans.ReadOnly.Strings (>= 4.0.32)
- Soenneker.Extensions.String (>= 4.0.733)
NuGet packages (6)
Showing the top 5 NuGet packages that depend on Soenneker.Extensions.Enumerable.String:
| Package | Downloads |
|---|---|
|
Soenneker.Extensions.Object
A collection of helpful Object extension methods |
|
|
Soenneker.Validators.Email.Disposable
Checks whether an email address uses a disposable or temporary domain. |
|
|
Soenneker.SendGrid.Contacts
Adds, retrieves, searches, and deletes SendGrid Marketing contacts. |
|
|
Soenneker.HttpClients.LoggingHandler
A handler that allows for injecting into HttpClients to log requests and responses |
|
|
Soenneker.Extensions.Dtos.Email
A collection of helpful EmailDto extension methods |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.1434 | 59 | 9/5/2026 |
| 4.0.1433 | 542 | 9/4/2026 |
| 4.0.1432 | 896 | 9/4/2026 |
| 4.0.1431 | 17,962 | 8/31/2026 |
| 4.0.1430 | 1,547 | 8/31/2026 |
| 4.0.1429 | 1,312 | 8/31/2026 |
| 4.0.1428 | 1,003 | 8/31/2026 |
| 4.0.1426 | 976 | 8/30/2026 |
| 4.0.1425 | 702 | 8/30/2026 |
| 4.0.1423 | 78 | 8/30/2026 |
| 4.0.1422 | 5,062 | 8/30/2026 |
| 4.0.1421 | 1,637 | 8/30/2026 |
| 4.0.1419 | 77 | 8/30/2026 |
| 4.0.1418 | 417 | 8/30/2026 |
| 4.0.1416 | 81 | 8/29/2026 |
| 4.0.1414 | 1,204 | 8/29/2026 |
| 4.0.1413 | 82 | 8/29/2026 |
| 4.0.1412 | 278 | 8/29/2026 |
| 4.0.1411 | 365 | 8/29/2026 |
| 4.0.1410 | 24,900 | 8/26/2026 |
Update dependency Soenneker.Extensions.String to 4.0.733 (#1906)