Linq2Span 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Linq2Span --version 0.1.0                
NuGet\Install-Package Linq2Span -Version 0.1.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="Linq2Span" Version="0.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Linq2Span --version 0.1.0                
#r "nuget: Linq2Span, 0.1.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.
// Install Linq2Span as a Cake Addin
#addin nuget:?package=Linq2Span&version=0.1.0

// Install Linq2Span as a Cake Tool
#tool nuget:?package=Linq2Span&version=0.1.0                

LINQ to Span

This project provides an implementation of LINQ for the Span<T> and ReadOnlySpan<T> types.

Normally, you cannot use LINQ with Span<T> because it is a stack-only type and LINQ methods are implemented over IEnumerable<T> and relies on those enumerables as being heap allocated objects.

You can convert a span to an enumerable by coping it into a list or array, but that is likely not desirable in scenarios where using spans are important.

This implementation captures the span in a ref struct called SpanQuery, along with the operations required to perform the query. Ideally, allowing you to compute an aggregate like Sum or Count, pick an indivual element with First or Single, or simply filter the span to a smaller size that is reasonable to copy.

The implementation is not allocation free, as the operations are captured as delegates.

Feel free to submit a pull request if you have fixes for bugs, implementations of missing operators or significant peformance improvements.

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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
0.2.2 95 10/2/2024
0.2.1 97 10/2/2024
0.2.0 95 10/2/2024
0.1.1 87 10/1/2024
0.1.0 91 9/28/2024