Albatross.Collections 8.0.2

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

Albatross.Collections

A .NET library providing extension methods for collections including batching, searching, merging, and efficient list manipulation.

Installation

dotnet add package Albatross.Collections

Quick Start

Batching

using Albatross.Collections;

var numbers = Enumerable.Range(1, 10);
foreach (var batch in numbers.Batch(3)) {
    Console.WriteLine(string.Join(", ", batch));
}
// Output: 1, 2, 3
//         4, 5, 6
//         7, 8, 9
//         10

Dictionary Operations

var cache = new Dictionary<string, int>();
var value = cache.GetOrAdd("key", () => ComputeExpensiveValue());

if (cache.TryGetAndRemove("key", out var removed)) {
    Console.WriteLine($"Removed: {removed}");
}

List Item Removal

var list = new List<int> { 1, 2, 3, 4, 5 };
var removed = list.RemoveAny(x => x % 2 == 0);
// list: [1, 3, 5], removed: [2, 4]

Binary Search (sorted data)

var sorted = new int[] { 1, 3, 5, 7, 9, 11 };

var result = sorted.BinarySearchFirstValueGreaterOrEqual(6, x => x);
Console.WriteLine(result); // 7

var result2 = sorted.BinarySearchFirstValueLessOrEqual(6, x => x);
Console.WriteLine(result2); // 5

Collection Merging (Full Outer Join)

var existing = new[] { new { Id = 1, Name = "A" }, new { Id = 2, Name = "B" } };
var incoming = new[] { new { Id = 2, Name = "B2" }, new { Id = 3, Name = "C" } };

existing.Merge(incoming,
    src => src.Id,
    dst => dst.Id,
    (src, dst) => Console.WriteLine($"Update: {dst.Name} -> {src.Name}"),
    src => Console.WriteLine($"Add: {src.Name}"),
    dst => Console.WriteLine($"Remove: {dst.Name}"));
// Output: Update: B -> B2
//         Remove: A
//         Add: C

API Reference

Method Description
Batch<T>(size) Split enumerable into arrays of specified size
GetOrAdd<K,T>(key, factory) Get or create dictionary value
TryGetAndRemove<K,T>(key, out value) Get and remove dictionary value
RemoveAny<T>(predicate) Remove matching items, returns removed items
TryGetOneAndRemove<T>(predicate, out item) Find and remove single item
BinarySearchFirstValueGreaterOrEqual<T,K>(key, selector) Find first value >= key
BinarySearchFirstValueLessOrEqual<T,K>(key, selector) Find first value ⇐ key
Merge<Src,Dst,TKey>(...) Full outer join with match/add/remove handlers
MergeAsync<Src,Dst,TKey>(...) Async version of Merge
AddRange<T>(items) Add multiple items to ICollection
ForEach<T>(action) Execute action on each item

License

MIT License - see LICENSE

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 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. 
.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.
  • .NETStandard 2.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Albatross.Collections:

Package Downloads
Albatross.CodeGen.CSharp

Package Description

Albatross.CodeGen.TypeScript

Package Description

Albatross.Messaging

A durable messaging library built on top of ZeroMQ

Albatross.CodeGen.Python

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.0.2 47 10/8/2026
8.0.1 769 12/11/2025
8.0.0 134 9/5/2025
7.5.13 105 7/22/2025
7.5.12 99 7/8/2025
7.5.11 118 6/24/2025
7.5.10 98 6/18/2025
7.5.9 140 3/19/2025