C5 3.0.0

dotnet add package C5 --version 3.0.0                
NuGet\Install-Package C5 -Version 3.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="C5" Version="3.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add C5 --version 3.0.0                
#r "nuget: C5, 3.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.
// Install C5 as a Cake Addin
#addin nuget:?package=C5&version=3.0.0

// Install C5 as a Cake Tool
#tool nuget:?package=C5&version=3.0.0                

C5 Generic Collection Library for C# and CLI

NuGet version (C5) .github/workflows/main.yml

The C5 library is a set of generic collection classes (or container classes) for the C# programming language and other generics-enabled languages on later versions of the .NET runtime (Common Language Runtime).

The C5 library provides a wide range of classic data structures, rich functionality, the best possible asymptotic time complexity, documented performance, and a thoroughly tested implementation.

Goals of the C5 library

The overall goal is for C5 to be a generic collection library for the C# programming language and the Common Language Infrastructure (CLI) whose functionality, efficiency and quality meets or exceeds what is available for similar contemporary programming platforms.

The design has been influenced by the collection libraries for Java and SmallTalk and the published critique of these.

However, it contains functionality and a regularity of design that considerably exceeds that of the standard libraries for those languages.


Research notes are available here: https://www.itu.dk/research/c5/.

Why yet another generic collection library

There are already other generic collection libraries for C#/CLI, including the System.Collections.Generic namespace introduced with .NET 2.0 and Wintellect's Power Collections for .NET by Peter Golde (http://powercollections.codeplex.com/).

The CLI generic collection library as implemented by in Microsoft .NET Framework 2.0 provides a limited choice of data structures.

In general, the CLI Framework library has a proliferation of methods variants and rather poor orthogonality.

Collection implementations such as array lists and linked lists have much the same functionality but do not implement a common interface. This impairs the learnability of the library in contexts where nano-second efficiency is more important that rich functionality, and the need to support also rather resource-constrained run-time systems.

The Power Collections library by Peter Golde augments the CLI version 2.0 collection library with various data structures and algorithms.

However, it accepts the basic design of the CLI collection classes and therefore suffers from some of the same shortcommings, and also does not provide most of the advanced functionality (updatable views, snapshots, directed enumeration, priority queue handles, ...) of C5.

Thus, in our opinion, C5 provides the most powerful, well-structured and scalable generic collections library available for C#/CLI.

What does the name C5 stand for?

This is not entirely clear, but it may stand for Copenhagen Comprehensive Collection Classes for C#, although the library may be used from VB.NET, F# and other CLI languages, not just C#. It has nothing to do with a Microsoft Dynamics product that used to be called Concorde C5/Damgaard C5/Navision C5, nor a real-time operation system called C5 (or Chorus), nor the C5 Corporation (system visualization), nor an Eclipse plug-in called C5, nor with cars such as the Citroën C5 or Corvette C5 or Clive Sinclair's ill-fated C5 concept vehicle.

The name may be inspired by the versatile C4 plastic explosive known from e.g. James Bond movies.

All trademarks belong to their owners.

State of completion

At the time of writing, library design and implementation are complete, and extensive unit tests have been written and applied systematically.

Most of the library API documentation is in place but requires proof-reading.

The C5 implementation was originally built on .NET 2.0 and has only recently been upgraded to .NET 4.0. It does not (yet) use a great number of the new features introduced with C# 3 and 4, notably LINQ and covariant and contravariant type parameters.

C5 targets .NET Standard 2.0, NET 6.0, and .NET 8.0.

Getting Started

  1. Get C5 from NuGet:

    dotnet add package C5
  2. Building the unit test project requires NUnit. If you have NuGet installed it should automatically add the reference.

    There are more than 1400 NUnit test cases which should execute in less than 5 seconds. All should pass.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  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. 
.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.
  • net6.0

    • No dependencies.
  • net8.0

    • No dependencies.

NuGet packages (46)

Showing the top 5 NuGet packages that depend on C5:

Package Downloads

This package provides support for sending metrics, histograms and opentracing spans to Wavefront via proxy or direct ingestion.


Streaming Percentile Estimation


Gridsum.DataflowEx is a dataflow and etl framework redesigned on top of Microsoft TPL Dataflow library with Object-Oriented Programming in mind. DataflowEx enables you to write reusable components and easily link them together as a high-level dataflow graph while still having the power of low-level blocks from TPL Dataflow. Other cool features include: Dataflow lifecycle management, built-in dataflow health monitor, cyclic graph auto completion support, sql bulk insertion support, etc. More information is available at: https://github.com/gridsum/dataflowex


Framework for building actors networks


Framework for building actors networks

GitHub repositories (15)

Showing the top 5 popular GitHub repositories that depend on C5:

Repository Stars
Project is DEAD, Discord server: https://discord.me/Catchem
An automated Pokémon Go Bot
An open source CMS, Relationship Management System (RMS) and Church Management System (ChMS) all rolled into one.
Platform for Situated Intelligence
recommender system library for the CLR (.NET)
Version Downloads Last updated
3.0.0 18,478 6/5/2024
3.0.0-rc 73,544 12/22/2021
3.0.0-beta 646,148 2/19/2019
2.5.3 5,374,759 7/24/2017
2.5.0 19,315 7/7/2017
2.4.5947.17249 195,268 4/13/2016
2.4.5828.26833 15,298 12/16/2015
2.4.5827.29151 2,254 12/15/2015 380,583 6/16/2014
2.3.0 5,226 6/10/2014
2.2.5073.27396 117,748 11/21/2013
2.2.4881.16939 18,712 5/13/2013
2.2.4822.42600 51,605 3/15/2013
2.1.4492.18142 36,007 4/19/2012
2.0.4398.25000 3,029 2/18/2012
2.0.4398.23817 3,936 1/16/2012
2.0.4398.21073 3,510 1/16/2012
2.0.1 2,853 11/17/2011
2.0.0 7,982 5/21/2011
1.0.2 68,466 5/11/2011

Release 3.0.0 of 2024-06-05

       - C5 now targets .NET Standard 2.0, .NET 6.0 and .NET 8.0.
       - Breaking change: Rec<T1, T2, ...> type removed.
       - Breaking change: All public readonly fields are now properties.
       - Breaking change: EventTypeEnum is now EventType.
       - Breaking change: custom KeyValuePair<K, V> has been replaced by the standard System.Collections.Generic.KeyValue<TKey, TValue> for better compatibility.
       - Breaking change: EnumerationDirection is now Direction.
       - Breaking change: Serializable attribute removed.