The C5 Generic Collection Library
for C# and CLI
IT University
of Copenhagen

The C5 Generic Collection Library

C5 is a library of generic collection classes for C# and other CLI languages and works with Microsoft .Net version 2.0 and later, and Mono version 2 and later.

C5 provides functionality and data structures not provided by the standard .Net System.Collections.Generic namespace, such as persistent tree data structures, heap based priority queues, hash indexed array lists and linked lists, and events on collection changes. Also, it is more comprehensive than collection class libraries on other similar platforms, such as Java. Unlike many other collection class libraries, C5 is designed with a strict policy of supporting "code to interface not implementation".


Downloads and resources


The C5 collection library provides the following collection concepts, described by C# interfaces: Directed enumerable, collection value, directed collection value, extensible collection, collection, sequenced collection, indexed collection, sorted collection, indexed sorted collection, persistent sorted collection, list, LIFO stack, FIFO queue, priority queue, dictionary, and sorted dictionary.

The C5 collection library provides the following data structures, described by C# classes: array list, doubly linked list, hash-indexed array list, hash-indexed linked list, hash set, hash bag (multiset), sorted array, wrapped array, tree set, tree bag (multiset), stack, double-ended queue, circular queue, priority queue (interval heap), hash dictionary, and tree dictionary.

See the relation between interfaces and classes for collections and for dictionaries.

The C5 collection library provides the following unusual functionality on collections and dictionaries: collection update events, multiple updatable list views, reversible enumeration, hash indexes on lists, snapshottable tree-based collections, priority queues with item handles, and in general a design with emphasis on orthogonality, flexibility, and preservation of invariants.

Authors, license and credits

The library is Copyright 2003-2016 Niels Kokholm, Peter Sestoft and Rasmus Lystroem and is released under an MIT-style open license.

It is based on the GCollections library created by Peter Sestoft during his visit to Microsoft Research, Cambridge in 2001. Niels Kokholm extended the library as a Master's thesis project at the IT University of Copenhagen, advised by Peter Sestoft. Subsequent completion of the library was financed in part by a grant from Microsoft Research University Relations.

Bug reports, feedback and suggestions are welcome, preferably at the Github C5 project site or else to

Niels Kokholm and Peter Sestoft; last update 2016-11-06