EnhancedLinq 1.0.0-alpha.5

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

EnhancedLinq

This library adds Additional LINQ style Deferred execution and Immediate enumeration mode extension methods for .NET.

Now updated to use C# 14 and extension everything as of version 0.12.0. C# language version must be set to 14 or higher for EnhancedLinq to work.

🚀 Included Methods

For a comprehensive list of included methods, check out the following resources:

📦 NuGet Packages

EnhancedLinq comes with several packages tailored to your needs:

  • EnhancedLinq: The core package that enhances your LINQ experience.
  • EnhancedLinq.Async: The IAsyncEnumerable supporting version of EnhancedLinq.
  • EnhancedLinq.Memory: This package is specifically for Span<T> and Memory<T>, providing helpful immediate mode extensions.
  • EnhancedLinq.MsExtensions: Focused on StringSegment from Microsoft.Extensions.Primitives, with plans to potentially expand support for other Microsoft.Extensions packages.

🛠️ Installing EnhancedLinq

Getting started with EnhancedLinq is easy! You can install the packages using the .NET SDK CLI, your IDE's package manager, or directly from the NuGet website.

Package Id NuGet Link .NET SDK CLI Command
EnhancedLinq EnhancedLinq NuGet dotnet add package EnhancedLinq.
EnhancedLinq.Async EnhancedLinq NuGet dotnet add package EnhancedLinq.Async
EnhancedLinq.Memory EnhancedLinq.Memory NuGet dotnet add package EnhancedLinq.Memory
EnhancedLinq.MsExtensions EnhancedLinq.MsExtensions NuGet dotnet add package EnhancedLinq.MsExtensions

📖 Usage

Here are some examples demonstrating how to use some methods provided by EnhancedLinq.

Deferred Execution Examples

ElementsAt This example shows how to find the elements at a given sequence of indices.


        var fruits = ["Apple", "Banana", "Cherry", "Date", "Elderberry" ];
        var indices = [1, 3]; // We want to retrieve "Banana" and "Date"
        
        IEnumerable<string> selectedFruits = fruits.ElementsAt(indices);

        Console.WriteLine("Selected Fruits:");
        foreach (string fruit in selectedFruits)
        {
            Console.WriteLine(fruit); // Outputs: Banana, Date
        }

IndicesOf This example shows how to find all the indices of a specific element in an IEnumerable<T>.


        var numbers = [ 1, 2, 3, 2, 4, 2, 5 ];
        int target = 2; // We want to find the indices of the number 2

        IEnumerable<int> indices = numbers.IndicesOf(target);

        Console.WriteLine("Indices of target element:");
        foreach (var index in indices)
        {
            Console.WriteLine(index); // Outputs: 1, 3, 5
        }

Immediate Enumeration Mode Examples

ContainsDuplicates This example shows how to check if an IEnumerable<T> contains any duplicate elements.

        var fruits = ["Apple", "Banana", "Cherry", "Apple" ]; // Contains a duplicate

        bool hasDuplicates = fruits.ContainsDuplicates();

        Console.WriteLine($"Does the list contain duplicates? {hasDuplicates}"); // Output: True

IndexOf This example shows how to find the index of the first element that matches a predicate in an IEnumerable<T>.

        var numbers = new List<int> { 10, 20, 30, 40, 50 };

        // Define a predicate to find the first number greater than 25
        Func<int, bool> predicate = n => n > 25;

        int index = numbers.IndexOf(predicate);

        Console.WriteLine($"Zero based index of the first element greater than 25: {index}"); // Output: 2

🏗️ Building

To build EnhancedLinq from source, follow these steps:

  1. Clone the repository.
  2. Open the solution in your preferred IDE or Code Editor.
  3. Build the desired project to restore dependencies and compile the project.

🤝 Contributing

I welcome contributions. If you have ideas for new features, improvements, or bug fixes, please check out the contributing guidelines for more information.

📜 License

EnhancedLinq is licensed under the MPL 2.0 license. Feel free to use and modify EnhancedLinq according to the terms of the license.

❓ Questions?

If you have any questions or experience any issues, please open a discussion in the repository's GitHub issues page.

🔄 Alternatives

While EnhancedLinq is a powerful tool, you may wish to explore these alternatives:

Why EnhancedLinq was created

In no particular order, these are some of the reasons why EnhancedLinq was created:

  • To move DotExtension LINQ style methods/operations to a separate library.
  • Hardly any .NET libraries exist that bring Linq style methods/operations to Span/Memory.
  • Hardly any .NET libraries exist that bring Linq style methods/operations to StringSegment and other Microsoft.Extensions.Primitives package types.
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 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 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 was computed.  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.

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.0.0-alpha.5 49 1/23/2026
1.0.0-alpha.4 53 1/3/2026
1.0.0-alpha.3 136 12/23/2025
1.0.0-alpha.2 381 12/8/2025
1.0.0-alpha.1 628 12/2/2025

* Updated internal Polyfill version from 9.6.0 to 9.7.5
* Updated DotExtensions from 9.3.0 to 9.4.1
* Add immediate mode ``Exclude`` extensions