Linq2Span 0.1.0
See the version list below for details.
dotnet add package Linq2Span --version 0.1.0
NuGet\Install-Package Linq2Span -Version 0.1.0
<PackageReference Include="Linq2Span" Version="0.1.0" />
paket add Linq2Span --version 0.1.0
#r "nuget: Linq2Span, 0.1.0"
// 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 | Versions 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. |
-
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.