Bodu.Collections 1.0.0

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

Bodu.Collections

API stability — Stable. The public API surface is committed; breaking changes are reserved for a major-version bump per SemVer.

The specialized generic-collection catalogue for the Bodu solution and for general .NET 8 use: bounded and ordered collections, bidirectional and layered dictionaries, navigable (order-statistic) sets and maps, interval and range-keyed lookups, graph and tree structures, and probabilistic sketches. The catalogue was split out of Bodu.Core with namespaces unchanged — code written against Bodu.Collections.Generic and its siblings keeps compiling; only the package reference changes. Every collection ships a struct enumerator for allocation-free iteration and implements the standard BCL interfaces (IEnumerable<T>, ICollection<T>, IReadOnlyCollection<T>, ISet<T>, IList<T>) so the types drop into existing code. The package references Bodu.Core for its shared primitives (ThrowHelper argument validation, IRandomGenerator, pooled buffers).

Installation

dotnet add package Bodu.Collections

Targets net8.0. Depends on Bodu.Core.

Collections

Type Namespace Summary
CircularBuffer<T> Bodu.Collections.Generic Fixed-capacity FIFO ring buffer with optional overwrite-on-full
Deque<T> Bodu.Collections.Generic Double-ended queue over a circular array; O(1) at either end
EvictingDictionary<TKey,TValue> Bodu.Collections.Generic Fixed-capacity dictionary with FIFO / LRU / LFU eviction
SequencedDictionary<TKey,TValue> Bodu.Collections.Generic Insertion- or access-ordered dictionary with O(1) first/last access and removal
BiDictionary<TKey,TValue> Bodu.Collections.Generic Bidirectional one-to-one dictionary with O(1) lookup in both directions
DefaultingDictionary<TKey,TValue> Bodu.Collections.Generic Dictionary whose indexer materializes missing entries via a value factory
LayeredDictionary<TKey,TValue> Bodu.Collections.Generic Live read-through view over ordered dictionary layers; writes go to the first layer
NavigableDictionary<TKey,TValue> Bodu.Collections.Generic Key-sorted dictionary with floor/ceiling/higher/lower, rank/select, and range queries in O(log n)
NavigableSet<T> Bodu.Collections.Generic Sorted set with the same nearest-neighbour, rank/select, and range-counting surface
IndexedSet<T> Bodu.Collections.Generic Insertion-ordered unique set with index-addressable IList<T> access
OrderedSet<T> Bodu.Collections.Generic Insertion-ordered unique set implementing ISet<T>
IndexedPriorityQueue<TElement,TPriority> Bodu.Collections.Generic Binary-heap priority queue with O(log n) re-prioritization and removal
MultiValueDictionary<TKey,TValue> Bodu.Collections.Generic Multiple values per key, exposed as IReadOnlyList<TValue>
Multiset<T> Bodu.Collections.Generic Unordered collection tracking element multiplicities
RangeSet<T> / RangeDictionary<TKey,TValue> Bodu.Collections.Generic Non-overlapping range containment / range-to-value mapping
IntervalTree<T> / IntervalTree<TKey,TValue> Bodu.Collections.Generic Freely overlapping closed intervals with stabbing and overlap-window queries in O(log n + k)
Table<TRow,TColumn,TValue> Bodu.Collections.Generic Two-dimensional map keyed by a row/column pair with live row and column projections
BitSet Bodu.Collections.Generic Growable packed bit array with Java BitSet semantics and bulk logical operations
SegmentedBuffer<T> Bodu.Collections.Generic Append-only chunked buffer that grows without copying existing elements

Graphs

The Bodu.Collections.Generic.Graphs namespace provides an adjacency-list Graph<T> (directed or undirected, optionally weighted), the static GraphAlgorithms catalogue (breadth-/depth-first traversal, Dijkstra shortest path, Kahn topological sort, connected components) over the read-only IReadOnlyGraph<T> / IReadOnlyWeightedGraph<TVertex> interfaces, and the element-keyed union-find structure DisjointSet<T>.

Trees and tries

The Bodu.Collections.Generic.Trees namespace provides Tree<T> (a mutable n-ary tree node with iterative, stack-safe traversals), the prefix trees Trie / Trie<TValue> (string set / string-keyed map with prefix queries), their path-compressed siblings RadixTrie / RadixTrie<TValue> (identical member-for-member surface over PATRICIA-style edges), and AhoCorasickAutomaton / AhoCorasickAutomaton<TValue> (immutable multi-pattern matchers that report every occurrence of every pattern in a single O(text + matches) pass).

Probabilistic collections

The Bodu.Collections.Probabilistic namespace ships three fixed-footprint approximate sketches, each with a one-sided, quantified error contract:

  • BloomFilter<T> — approximate set membership with no false negatives; false positives approach the design rate as the fill approaches ExpectedItems.
  • CountMinSketch<T> — approximate frequencies that never underestimate; overestimates by at most ε · TotalCount with probability ≥ 1 − δ.
  • HyperLogLog<T> — approximate distinct counts with a relative standard error of about 1.04/√m for m = 2^precision one-byte registers.

All three hash through an IEqualityComparer<T>, merge with parameter-compatible instances, and round-trip their state through an opaque, version-checked export format. None is thread-safe.

The thread-safe variants (ConcurrentCircularBuffer<T>, ConcurrentHashSet<T>) ship separately in the Bodu.Collections.Concurrent package.

Testing

Tests live in test/ as MSTest partial classes mirroring src/. Run tiers via the runsettings files at the solution root:

dotnet test Bodu.Collections/test/Bodu.Collections.Test.csproj --settings smoke.runsettings
dotnet test Bodu.Collections/test/Bodu.Collections.Test.csproj --settings bvt.runsettings
dotnet test Bodu.Collections/test/Bodu.Collections.Test.csproj --settings regression.runsettings

Collection behaviour is validated through shared contract bases (CollectionContractTests<>, ReadOnlyCollectionContractTests<>, SetContractTests<>, EnumeratorContractTests<>, DebugViewContractTests<>, NonGenericCollectionContractTests<>) so every collection is held to the same interface contract.

License

MIT. © Bodu Pty. Ltd.

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.  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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Bodu.Collections:

Package Downloads
Bodu.Collections.Concurrent

Thread-safe collection variants for .NET 8: a lock-free Vyukov MPMC ConcurrentCircularBuffer<T>, a lock-free split-ordered ConcurrentHashSet<T>, and a lock-striped ConcurrentEvictingDictionary<TKey,TValue> bounded cache (FIFO/LRU/LFU/MRU/SecondChance/Random policies, optional TTL expiry). Split out of Bodu.Collections with namespaces unchanged; references Bodu.Collections.

Bodu.IO.Pst

A low-level, read-only container library for the Outlook personal-folders format (PST / MS-PST). Reads the node database of Unicode and ANSI files — the header, the node and block B-trees, block data with the format's permute and cyclic encodings decoded and checksums verified, multi-block data trees, and per-node subnode trees — and the LTP layer over it: heap-on-node, BTree-on-heap, and per-node property-context and table-context views with wire-typed values. The substrate a message-level reader builds on. No MAPI semantics and no writing.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 544 9/24/2026
0.7.0 161 9/24/2026
0.6.0 76 9/24/2026
0.5.0 79 9/23/2026