Wolfgang.Extensions.IEnumerable 1.4.0

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

Wolfgang.Extensions.IEnumerable

A collection of extension methods for IEnumerable<T> in .NET.

NuGet NuGet downloads PR build Release License: MIT .NET GitHub


📦 Installation

dotnet add package Wolfgang.Extensions.IEnumerable

NuGet Package: Wolfgang.Extensions.IEnumerable


📄 License

This project is licensed under the MIT License. See the LICENSE file for details.


📚 Documentation


🚀 Quick Start

using System.Collections.Generic;
using System.Linq;
using Wolfgang.Extensions.IEnumerable;

var items = new[] { 1, 2, 3, 4, 5 };

items.ForEach(Console.WriteLine);                 // prints 1..5 (eager)

var doubled = items
    .Do(x => Console.WriteLine($"seen: {x}"))     // lazy passthrough side-effect
    .Select(x => x * 2)
    .ToList();

items.IsEmpty();                                  // false
((int[]?)null).IsNullOrEmpty();                   // true (only IsNullOrEmpty accepts null)
items.None(x => x > 10);                          // true
items.None();                                     // false (has items)

var shuffled = items.Shuffle().ToList();          // random order (Fisher-Yates)

None of these methods mutate the source sequence — ForEach and Do invoke your Action<T> for its side effects but never modify the upstream items themselves. Only IsNullOrEmpty accepts a null source (returns true); every other method throws ArgumentNullException when source is null. Methods that take an action / predicate also throw on a null callback.


✨ Features

Methods

Method Description
ForEach(Action<T>) Eagerly invokes an action for each item. Throws ArgumentNullException if source or action is null.
Do(Action<T>) Lazy variant of ForEach — yields each item after invoking the action.
IsEmpty() Returns true when the sequence contains no elements.
IsNullOrEmpty() Returns true when the sequence is null OR contains no elements.
None() Inverse of Any() — true when the sequence has no elements.
None(Func<T, bool> predicate) true when no element matches the predicate.
Shuffle() Returns a new sequence in random order (Fisher-Yates + thread-safe RNG). Eager — the input is fully consumed before the method returns.
ToEnumerable() Wraps the source in a lazy iterator so the returned sequence is guaranteed not to be a more concrete type (List<T>, ICollection<T>, array). Useful in tests that need to exercise non-ICollection code paths.

Examples

using System.Collections.Generic;
using System.Linq;
using Wolfgang.Extensions.IEnumerable;

// ForEach vs Do
new[] { 1, 2, 3 }.ForEach(Console.WriteLine);       // 1 2 3 (eager, void)
var pipeline = new[] { 1, 2, 3 }
    .Do(x => Console.WriteLine($"tap: {x}"))        // lazy passthrough
    .Where(x => x > 1);                             // logs only when enumerated

// Emptiness
new int[0].IsEmpty();                                // true
((IEnumerable<int>?)null).IsNullOrEmpty();           // true (null-tolerant)
// ((IEnumerable<int>?)null).IsEmpty();              // throws ArgumentNullException

// None
new[] { 1, 2, 3 }.None();                            // false
new[] { 1, 2, 3 }.None(x => x < 0);                  // true

// Shuffle
var deck = Enumerable.Range(1, 52).Shuffle().ToList();

// ToEnumerable — strip the concrete type for test fixtures that need to
// exercise the non-ICollection slow path.
IEnumerable<int> slowPath = new List<int> { 1, 2, 3 }.ToEnumerable();
// slowPath is List<int>      // false
// slowPath is ICollection<int> // false

🎯 Target Frameworks

Framework Versions
.NET Framework .NET 4.6.2
.NET Standard .NET Standard 2.0
.NET .NET 8.0, .NET 10.0

🛠️ Building from Source

Prerequisites

Build Steps

git clone https://github.com/Chris-Wolfgang/IEnumerable-Extensions.git
cd IEnumerable-Extensions
dotnet restore
dotnet build --configuration Release
dotnet test --configuration Release

🤝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for code quality standards, build and test instructions, and pull request guidelines.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 was computed.  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 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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.6.2

    • No dependencies.
  • .NETStandard 2.0

    • No dependencies.
  • net10.0

    • No dependencies.
  • net8.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
1.4.0 136 6/3/2026
1.3.0 112 5/30/2026
1.2.1 121 5/29/2026
1.2.0 120 4/27/2026
1.1.0 124 3/25/2026
1.0.0 123 1/20/2026
1.0.0-rc1 125 1/20/2026