budul.EnumerableExtensions 2.0.0

dotnet add package budul.EnumerableExtensions --version 2.0.0
                    
NuGet\Install-Package budul.EnumerableExtensions -Version 2.0.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="budul.EnumerableExtensions" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="budul.EnumerableExtensions" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="budul.EnumerableExtensions" />
                    
Project file
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 budul.EnumerableExtensions --version 2.0.0
                    
#r "nuget: budul.EnumerableExtensions, 2.0.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 budul.EnumerableExtensions@2.0.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=budul.EnumerableExtensions&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=budul.EnumerableExtensions&version=2.0.0
                    
Install as a Cake Tool

EnumerableExtensions

A collection of extension methods for working with enumerable data in .NET, providing utilities for counting, merging, converting, grouping and manipulating collections.

Installation

Install via NuGet:

dotnet add package budul.EnumerableExtensions

Or visit: https://www.nuget.org/packages/budul.EnumerableExtensions

Features

Counting & Aggregation

  • CountOrDefault<T>() - Returns count or 0 if null/empty
  • MaxOrDefault<T>() / MaxOrNull<T>() - Safe max operations
  • MinOrDefault<T>() / MinOrNull<T>() - Safe min operations

Merging

  • Merge() - Combines non-null items into a delimited string with optional sorting and distinct filtering
  • Merge<T, TProp>() - Merges items by selecting a specific property

Conversion

  • ToArrayOrDefault() - Converts to array or returns null if empty
  • ToListOrDefault() - Converts to list or returns null if empty
  • AsSingleEnumerable() / AsArray() / AsList() - Wraps a single value

Grouping & Chaining

  • ChunkAfter(), ChunkBefore(), SplitAt(), SplitAtChange(), Framed()
  • GroupByHash() - Groups by the values of several properties
  • ToPairs(), ToTriples(), ToConsecutivePairs(), ToConsecutiveTriples(), DistinctSuccessive()

Sequences

  • MapSequence() - Finds a sequence inside a master track (KMP) and maps the master indexes to the input items

Usage Example

using EnumerableExtensions;
var items = new[] { "c", "b", "a", "c" };

// Merge with sorting and distinct
string result = items.Merge(); // "a,b,c"

// Merge without sorting (still distinct)
string unsorted = items.Merge(preventSort: true); // "c,b,a"

// Merge without sorting and without distinct
string raw = items.Merge(preventSort: true, preventDistinct: true); // "c,b,a,c"

// Safe counting
int count = items.CountOrDefault(); // 4

Target Frameworks

  • .NET 10

Breaking changes in 2.0

  • Target framework is .NET 10 only (previously .NET Standard 2.0 / 2.1, .NET 7 / 8).
  • AsEnumerable<T>(this T) is now AsSingleEnumerable<T>(this T), the old name hijacked System.Linq.Enumerable.AsEnumerable for arrays and lists.
  • ToConsecutivePairs and ToConsecutiveTriples return nothing for an empty sequence.
  • Merge keeps default values of value types (e.g. 0), sorts numbers numerically and strings ordinally.
  • GroupByHash compares the property values themselves instead of a hash, the dependency on budul.HashExtensions is gone.
  • Argument validation of iterator based methods now happens at the call, not at the first enumeration.

License

MIT

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

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
2.0.0 109 11/26/2026
1.34.1 415 12/25/2025
1.34.0 293 12/24/2025
1.33.0 476 7/11/2023
1.32.0 342 5/10/2023
1.31.0 457 2/28/2023
1.30.0 610 8/24/2022
1.29.0 657 7/29/2022
1.28.0 611 7/28/2022
1.27.0 612 7/28/2022
1.26.0 618 7/27/2022
1.25.0 691 2/9/2022
1.24.1 675 2/3/2022
1.24.0 636 2/1/2022
1.23.0 539 10/26/2021
1.22.0 560 10/8/2021
1.21.2 548 9/28/2021
1.21.1 535 8/25/2021
1.21.0 529 8/17/2021
1.20.0 567 5/20/2021
Loading failed