collection-iterable-methods
2.0.2
See the version list below for details.
dotnet add package collection-iterable-methods --version 2.0.2
NuGet\Install-Package collection-iterable-methods -Version 2.0.2
<PackageReference Include="collection-iterable-methods" Version="2.0.2" />
<PackageVersion Include="collection-iterable-methods" Version="2.0.2" />
<PackageReference Include="collection-iterable-methods" />
paket add collection-iterable-methods --version 2.0.2
#r "nuget: collection-iterable-methods, 2.0.2"
#:package collection-iterable-methods@2.0.2
#addin nuget:?package=collection-iterable-methods&version=2.0.2
#tool nuget:?package=collection-iterable-methods&version=2.0.2
collection-iterable-methods
Write expressive C#. Get more from every collection.
Bring the simplicity of Filter, Map, and Reduce to .NET 8. Turn arrays, lists, and enumerables into readable pipelines with automatic type inference, LINQ integration, and powerful async and parallel operations. Zero package dependencies.
Explore the website · Install from NuGet · API guide · About the developer
Why use it?
- Express the transformation. Filter, map, slice, sort, and reduce with familiar names and concise, chainable code.
- Keep the power of C#. Transform between types with full inference, use indexed callbacks, and compose with LINQ.
- Put concurrency to work. Await CPU operations, run callbacks in parallel, and configure cancellation and concurrency in one place.
- Benefit from optimized paths. LINQ-backed transformations, bounded streaming slices, and cached sort keys improve core collection operations.
Faster where it counts
Selected operations show substantial improvements in the recorded 2.0 candidate vs. 1.0.2 source benchmarks:
| Operation | Measured speedup | Repeat run |
|---|---|---|
| Map | 2.31–9.89× | 2.14–10.29× |
| Filter | 1.35–4.61× | 1.38–4.63× |
| Slice | 1.59–12.43× | 1.68–12.40× |
| ForEach | 1.49–3.94× | 1.64–3.78× |
Ranges cover the tested inputs for each operation. Explore all 156 workloads, methodology, and allocation measurements in the full benchmark report.
Install
Requires a .NET 8-compatible project. Current stable release: 2.0.2.
dotnet add package collection-iterable-methods --version 2.0.2
A first transformation
using CollectionIterable;
var numbers = new[] { 1, 2, 3, 4, 5, 6 };
var labels = numbers
.Filter(number => number % 2 == 0)
.Map(number => $"Item {number}")
.ToArray();
// ["Item 2", "Item 4", "Item 6"]
var total = numbers.Reduce((sum, number) => sum + number, 0); // 21
var middle = numbers.Slice(1, 4).ToArray(); // [2, 3, 4]
var indexed = numbers.Map((number, index) => $"{index}: {number}");
Filter, Map, and Slice are lazy. Enumerate to execute them; call ToArray() to capture a result. Map infers both the input and output type. Ordinary LINQ methods can follow these operations.
Choose an execution model
| Use case | Namespace | Start with |
|---|---|---|
| Expressive collection pipelines | CollectionIterable |
Filter, Map, Reduce, Slice |
| Awaitable CPU operations | CollectionIterableAsync |
FilterAsync, ForEachAsync |
| Concurrent CPU callbacks | CollectionIterableParallel |
FilterParallel, ForEachParallel |
| Cancellation and concurrency options | CollectionIterableUtils |
IIterableOptions |
Put async to work
using CollectionIterableAsync;
var evens = await new[] { 1, 2, 3, 4 }.FilterAsync(n => n % 2 == 0);
// Work is complete; evens contains 2, 4.
Take control of parallel execution
using CollectionIterableParallel;
using CollectionIterableUtils;
using var cancellation = new CancellationTokenSource();
var options = new IIterableOptions
{
parallelOptions = new ParallelOptions { MaxDegreeOfParallelism = 4 },
cancellationToken = cancellation.Token
};
var evens = new[] { 1, 2, 3, 4 }.FilterParallel(n => n % 2 == 0, options);
// Contains 2, 4. Order is unspecified.
Everything you need to keep building
Explore the API and migration guide for execution behavior, ordering, cancellation, and upgrading from 1.0.2. Async methods accept synchronous CPU callbacks; use native async APIs for I/O. Parallel filter results are unordered.
Want to contribute? See the development guide for builds, tests, benchmarks, and website deployment.
Created by Johnny Quesada. Open source under the MIT license.
| 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. 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 was computed. 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. |
-
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.