C5  2.4
The C5 Generic Collection Library for C# and CLI is a comprehensive collection library supporting lists, sets, bags, dictionaries, priority queues, (FIFO) queues, and (LIFO) stacks. C5 runs on .NET 3.5+, Silverlight 5, Windows Phone 8, Xamarin.iOS, Xamarin.Android, and Mono.
C5 Namespace Reference

Classes

class  ArrayBase
 Base class for collection classes of dynamic array type implementations. More...
 
class  ArrayList
 A list collection based on a plain dynamic array data structure. Expansion of the internal array is performed by doubling on demand. The internal array is only shrinked by the Clear method. More...
 
class  C5Random
 A modern random number generator based on G. Marsaglia: Seeds for Random Number Generators, Communications of the ACM 46, 5 (May 2003) 90-93; and a posting by Marsaglia to comp.lang.c on 2003-04-03. More...
 
class  CircularQueue
 
class  ClearedEventArgs
 
class  ClearedRangeEventArgs
 
class  CollectionBase
 Base class (abstract) for ICollection implementations. More...
 
class  CollectionModifiedException
 An exception thrown by enumerators, range views etc. when accessed after the underlying collection has been modified. More...
 
class  CollectionValueBase
 Base class for classes implementing ICollectionValue[T] More...
 
class  ComparerFactory
 Factory class to create comparers and equality comparers using Func delegates More...
 
class  ComparerZeroHashCodeEqualityComparer
 An equalityComparer compatible with a given comparer. All hash codes are 0, meaning that anything based on hash codes will be quite inefficient.
 
class  Debug
 Class containing debugging symbols - to eliminate preprocessor directives
 
class  DictionaryBase
 A base class for implementing a dictionary based on a set collection implementation. See the source code for T:C5.HashDictionary`2 for an example More...
 
class  DirectedCollectionBase
 
class  DirectedCollectionValueBase
 
class  DropMultiplicity
 
class  DuplicateNotAllowedException
 An exception thrown when an operation attempts to create a duplicate in a collection with set semantics (P:C5.IExtensible`1.AllowsDuplicates is false) or attempts to create a duplicate key in a dictionary. More...
 
class  EnumerableBase
 A base class for implementing an IEnumerable<T> More...
 
class  EqualityComparer
 Utility class for building default generic equality comparers.
 
class  EventBlock
 Holds the real events for a collection
 
class  FixedSizeCollectionException
 
class  GuardedCollection
 A read-only wrapper for an T:C5.ICollection`1, More...
 
class  GuardedCollectionValue
 A read-only wrapper for an ICollectionValue<T> More...
 
class  GuardedDictionary
 A read-only wrapper for a dictionary. More...
 
class  GuardedDirectedCollectionValue
 A read-only wrapper for a directed collection More...
 
class  GuardedDirectedEnumerable
 A read-only wrapper for a generic directed enumerable More...
 
class  GuardedEnumerable
 A read-only wrapper class for a generic enumerable More...
 
class  GuardedEnumerator
 A read-only wrapper class for a generic enumerator More...
 
class  GuardedIndexedSorted
 Read-only wrapper for indexed sorted collections More...
 
class  GuardedList
 A read-only wrapper for a generic list collection Suitable as a wrapper for LinkedList, HashedLinkedList, ArrayList and HashedArray. T:C5.LinkedList`1, T:C5.HashedLinkedList`1, T:C5.ArrayList`1 or T:C5.HashedArray`1. More...
 
class  GuardedQueue
 A read-only wrapper for a generic indexable queue (allows indexing). More...
 
class  GuardedSequenced
 A read-only wrapper for a sequenced collection More...
 
class  GuardedSorted
 A read-only wrapper for a sorted collection More...
 
class  GuardedSortedDictionary
 A read-only wrapper for a sorted dictionary. More...
 
class  HashBag
 A bag collection based on a hash table of (item,count) pairs. More...
 
class  HashDictionary
 A generic dictionary class based on a hash set class T:C5.HashSet`1. More...
 
class  HashedArrayList
 A list collection based on a plain dynamic array data structure. Expansion of the internal array is performed by doubling on demand. The internal array is only shrinked by the Clear method. More...
 
class  HashedLinkedList
 A list collection class based on a doubly linked list data structure. More...
 
class  HashSet
 A set collection class based on linear hashing More...
 
interface  ICollection
 The simplest interface of a main stream generic collection with lookup, insertion and removal operations. More...
 
interface  ICollectionValue
 A generic collection that may be enumerated and can answer efficiently how many items it contains. Like More...
 
interface  IDictionary
 A dictionary with keys of type K and values of type V. Equivalent to a finite partial map from K to V. More...
 
interface  IDirectedCollectionValue
 A sized generic collection, that can be enumerated backwards. More...
 
interface  IDirectedEnumerable
 A generic collection, that can be enumerated backwards. More...
 
interface  IExtensible
 A generic collection to which one may add items. This is just the intersection of the main stream generic collection interfaces and the priority queue interface, T:C5.ICollection`1 and T:C5.IPriorityQueue`1. More...
 
interface  IIndexed
 A sequenced collection, where indices of items in the order are maintained More...
 
interface  IIndexedSorted
 A collection where items are maintained in sorted order together with their indexes in that order. More...
 
interface  IList
 This is an indexed collection, where the item order is chosen by the user at insertion time. More...
 
class  IncompatibleViewException
 An exception thrown by operations on a list that expects an argument that is a view on the same underlying list. More...
 
class  InternalComparer
 Defines a method that a type implements to compare two objects. This class is intentionally declared internal - use the ComparerFactory to create an instance.
 
class  InternalEqualityComparer
 Defines methods to support the comparison of objects for equality. This class is intentionally declared internal - use the ComparerFactory to create an instance.
 
class  InternalException
 An exception to throw from library code when an internal inconsistency is encountered. More...
 
class  IntervalHeap
 A priority queue class based on an interval heap data structure. More...
 
class  InvalidPriorityQueueHandleException
 
interface  IPersistentSorted
 The type of a sorted collection with persistence More...
 
interface  IPriorityQueue
 A generic collection of items prioritized by a comparison (order) relation. Supports adding items and reporting or removing extremal elements. More...
 
interface  IPriorityQueueHandle
 The base type of a priority queue handle More...
 
interface  IQueue
 The interface describing the operations of a FIFO queue data structure. More...
 
interface  ISequenced
 An editable collection maintaining a definite sequence order of the items. More...
 
interface  IShowable
 (Describe usage of "L:300" format string.) More...
 
interface  ISorted
 A sorted collection, i.e. a collection where items are maintained and can be searched for in sorted order. Thus the sequence order is given as a sorting order. More...
 
interface  ISortedDictionary
 A dictionary with sorted keys. More...
 
interface  IStack
 The interface describing the operations of a LIFO stack data structure. More...
 
class  ItemAtEventArgs
 
class  ItemCountEventArgs
 
class  KeyValuePair
 An entry in a dictionary from K to V. More...
 
class  KeyValuePairComparer
 Default comparer for dictionary entries in a sorted dictionary. Entry comparisons only look at keys and uses an externally defined comparer for that. More...
 
class  KeyValuePairEqualityComparer
 Default equalityComparer for dictionary entries. Operations only look at keys and uses an externally defined equalityComparer for that. More...
 
class  LinkedList
 A list collection class based on a doubly linked list data structure. More...
 
class  Logger
 Logging module
 
class  MappedCollectionValue
 
class  MappedDirectedCollectionValue
 
class  MappedDirectedEnumerable
 
class  MultiplicityOne
 
class  NoSuchItemException
 An exception thrown by a lookup or lookup with update operation that does not find the lookup item and has no other means to communicate failure. More...
 
class  NotAViewException
 An exception thrown by an operation on a list (T:C5.IList`1) that only makes sense for a view, not for an underlying list. More...
 
class  NotComparableException
 An exception thrown by an operation that need to construct a natural comparer for a type. More...
 
class  ProxyEventBlock
 Tentative, to conserve memory in GuardedCollectionValueBase This should really be nested in Guarded collection value, only have a guardereal field
 
class  ReadOnlyCollectionException
 An exception thrown by an update operation on a Read-Only collection or dictionary. More...
 
struct  Rec
 A generic record type with two fields. More...
 
struct  RecConst
 
class  SequencedBase
 Base class (abstract) for sequenced collection implementations. More...
 
class  SequencedCollectionEqualityComparer
 Prototype for a sequenced equalityComparer for something (T) that implements ISequenced[W]. This will use ISequenced[W] specific implementations of the equality comparer operations. More...
 
class  Showing
 
class  SortedArray
 A collection class implementing a sorted dynamic array data structure. More...
 
class  SortedArrayDictionary
 
class  SortedDictionaryBase
 A base class for implementing a sorted dictionary based on a sorted set collection implementation. See the source code for T:C5.TreeDictionary`2 for an example More...
 
class  Sorting
 A utility class with functions for sorting arrays with respect to an IComparer<T> More...
 
class  TreeBag
 An implementation of Red-Black trees as an indexed, sorted collection with bag semantics, cf. CLRS. (T:C5.TreeBag`1 for an implementation with set semantics).
The comparer (sorting order) may be either natural, because the item type is comparable (generic: T:C5.IComparable`1 or non-generic: System.IComparable) or it can be external and supplied by the user in the constructor.
Each distinct item is only kept in one place in the tree - together with the number of times it is a member of the bag. Thus, if two items that are equal according More...
 
class  TreeDictionary
 A sorted generic dictionary based on a red-black tree set. More...
 
class  TreeSet
 An implementation of Red-Black trees as an indexed, sorted collection with set semantics, cf. CLRS. T:C5.TreeBag`1 for a version with bag semantics. T:C5.TreeDictionary`2 for a sorted dictionary based on this tree implementation. The comparer (sorting order) may be either natural, because the item type is comparable (generic: T:C5.IComparable`1 or non-generic: System.IComparable) or it can be external and supplied by the user in the constructor. More...
 
class  UnlistenableEventException
 
class  UnsequencedCollectionEqualityComparer
 Prototype for an unsequenced equalityComparer for something (T) that implements ICollection[W] This will use ICollection[W] specific implementations of the equalityComparer operations More...
 
class  ViewDisposedException
 An exception thrown when trying to access a view (a list view on a T:C5.IList`1 or a snapshot on a T:C5.IPersistentSorted`1) that has been invalidated by some earlier operation. More...
 
class  WeakViewList
 This class is shared between the linked list and array list implementations. More...
 
class  WrappedArray
 An advanced interface to operations on an array. The array is viewed as an T:C5.IList`1 of fixed size, and so all operations that would change the size of the array will be invalid (and throw T:C5.FixedSizeCollectionException More...
 

Enumerations

enum  Speed : short { Speed.PotentiallyInfinite = 1, Speed.Linear = 2, Speed.Log = 3, Speed.Constant = 4 }
 The symbolic characterization of the speed of lookups for a collection. The values may refer to worst-case, amortized and/or expected asymtotic complexity wrt. the collection size. More...
 
enum  EnumerationDirection { EnumerationDirection.Forwards, EnumerationDirection.Backwards }
 Direction of enumeration order relative to original collection. More...
 
enum  EventTypeEnum {
  EventTypeEnum.None = 0x00000000, EventTypeEnum.Changed = 0x00000001, EventTypeEnum.Cleared = 0x00000002, EventTypeEnum.Added = 0x00000004,
  EventTypeEnum.Removed = 0x00000008, EventTypeEnum.Basic = 0x0000000f, EventTypeEnum.Inserted = 0x00000010, EventTypeEnum.RemovedAt = 0x00000020,
  EventTypeEnum.All = 0x0000003f
}
 
enum  MutualViewPosition { MutualViewPosition.Contains, MutualViewPosition.ContainedIn, MutualViewPosition.NonOverlapping, MutualViewPosition.Overlapping }
 Characterize the mutual position of some view B (other) relative to view A (this) More...
 

Functions

delegate void CollectionChangedHandler< T > (object sender)
 The type of event raised after an operation on a collection has changed its contents. Normally, a multioperation like AddAll, M:C5.IExtensible`1.AddAll(System.Collections.Generic.IEnumerable<`0>) will only fire one CollectionChanged event. Any operation that changes the collection must fire CollectionChanged as its last event. More...
 
delegate void CollectionClearedHandler< T > (object sender, ClearedEventArgs eventArgs)
 The type of event raised after the Clear() operation on a collection. Note: The Clear() operation will not fire ItemsRemoved events. More...
 
delegate void ItemsAddedHandler< T > (object sender, ItemCountEventArgs< T > eventArgs)
 The type of event raised after an item has been added to a collection. The event will be raised at a point of time, where the collection object is in an internally consistent state and before the corresponding CollectionChanged event is raised. Note: an Update operation will fire an ItemsRemoved and an ItemsAdded event. Note: When an item is inserted into a list (T:C5.IList`1), both ItemInserted and ItemsAdded events will be fired. More...
 
delegate void ItemsRemovedHandler< T > (object sender, ItemCountEventArgs< T > eventArgs)
 The type of event raised after an item has been removed from a collection. The event will be raised at a point of time, where the collection object is in an internally consistent state and before the corresponding CollectionChanged event is raised. Note: The Clear() operation will not fire ItemsRemoved events. Note: an Update operation will fire an ItemsRemoved and an ItemsAdded event. Note: When an item is removed from a list by the RemoveAt operation, both an ItemsRemoved and an ItemRemovedAt event will be fired. More...
 
delegate void ItemInsertedHandler< T > (object sender, ItemAtEventArgs< T > eventArgs)
 The type of event raised after an item has been inserted into a list by an Insert, InsertFirst or InsertLast operation. The event will be raised at a point of time, where the collection object is in an internally consistent state and before the corresponding CollectionChanged event is raised. Note: an ItemsAdded event will also be fired. More...
 
delegate void ItemRemovedAtHandler< T > (object sender, ItemAtEventArgs< T > eventArgs)
 The type of event raised after an item has been removed from a list by a RemoveAt(int i) operation (or RemoveFirst(), RemoveLast(), Remove() operation). The event will be raised at a point of time, where the collection object is in an internally consistent state and before the corresponding CollectionChanged event is raised. Note: an ItemRemoved event will also be fired. More...
 

Enumeration Type Documentation

Direction of enumeration order relative to original collection.

Enumerator
Forwards 

Same direction

Backwards 

Opposite direction

enum C5.EventTypeEnum
strong

Enumerator
None 
Changed 
Cleared 
Added 
Removed 
Basic 
Inserted 
RemovedAt 
All 
enum C5.MutualViewPosition
strong

Characterize the mutual position of some view B (other) relative to view A (this)

Enumerator
Contains 

B contains A(this)

ContainedIn 

B is containd in A(this), but not vice versa

NonOverlapping 

A and B does not overlap

Overlapping 

A and B overlap, but neither is contained in the other

enum C5.Speed : short
strong

The symbolic characterization of the speed of lookups for a collection. The values may refer to worst-case, amortized and/or expected asymtotic complexity wrt. the collection size.

Enumerator
PotentiallyInfinite 

Counting the collection with the

Count property may not return (for a synthetic and potentially infinite collection).

Linear 

Lookup operations like

Contains(T item) or the Count property may take time O(n), where n is the size of the collection.

Log 

Lookup operations like

Contains(T item) or the Count property takes time O(log n), where n is the size of the collection.

Constant 

Lookup operations like

Contains(T item) or the Count property takes time O(1), where n is the size of the collection.

Function Documentation

delegate void C5.CollectionChangedHandler< T > ( object  sender)

The type of event raised after an operation on a collection has changed its contents. Normally, a multioperation like AddAll, M:C5.IExtensible`1.AddAll(System.Collections.Generic.IEnumerable<`0>) will only fire one CollectionChanged event. Any operation that changes the collection must fire CollectionChanged as its last event.

delegate void C5.CollectionClearedHandler< T > ( object  sender,
ClearedEventArgs  eventArgs 
)

The type of event raised after the Clear() operation on a collection. Note: The Clear() operation will not fire ItemsRemoved events.

Parameters
sender
eventArgs
delegate void C5.ItemInsertedHandler< T > ( object  sender,
ItemAtEventArgs< T >  eventArgs 
)

The type of event raised after an item has been inserted into a list by an Insert, InsertFirst or InsertLast operation. The event will be raised at a point of time, where the collection object is in an internally consistent state and before the corresponding CollectionChanged event is raised. Note: an ItemsAdded event will also be fired.

Parameters
sender
eventArgs
delegate void C5.ItemRemovedAtHandler< T > ( object  sender,
ItemAtEventArgs< T >  eventArgs 
)

The type of event raised after an item has been removed from a list by a RemoveAt(int i) operation (or RemoveFirst(), RemoveLast(), Remove() operation). The event will be raised at a point of time, where the collection object is in an internally consistent state and before the corresponding CollectionChanged event is raised. Note: an ItemRemoved event will also be fired.

Parameters
sender
eventArgs
delegate void C5.ItemsAddedHandler< T > ( object  sender,
ItemCountEventArgs< T >  eventArgs 
)

The type of event raised after an item has been added to a collection. The event will be raised at a point of time, where the collection object is in an internally consistent state and before the corresponding CollectionChanged event is raised. Note: an Update operation will fire an ItemsRemoved and an ItemsAdded event. Note: When an item is inserted into a list (T:C5.IList`1), both ItemInserted and ItemsAdded events will be fired.

Parameters
sender
eventArgsAn object with the item that was added
delegate void C5.ItemsRemovedHandler< T > ( object  sender,
ItemCountEventArgs< T >  eventArgs 
)

The type of event raised after an item has been removed from a collection. The event will be raised at a point of time, where the collection object is in an internally consistent state and before the corresponding CollectionChanged event is raised. Note: The Clear() operation will not fire ItemsRemoved events. Note: an Update operation will fire an ItemsRemoved and an ItemsAdded event. Note: When an item is removed from a list by the RemoveAt operation, both an ItemsRemoved and an ItemRemovedAt event will be fired.

Parameters
sender
eventArgsAn object with the item that was removed