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.GuardedCollection< T > Class Template Reference

A read-only wrapper for an T:C5.ICollection`1, More...

Inheritance diagram for C5.GuardedCollection< T >:
C5.GuardedCollectionValue< T > C5.ICollection< T > C5.GuardedEnumerable< T > C5.ICollectionValue< T > C5.IExtensible< T > C5.IShowable C5.ICollectionValue< T > C5.IShowable C5.GuardedSequenced< T > C5.GuardedList< T > C5.GuardedSorted< T > C5.GuardedIndexedSorted< T >

Public Member Functions

 GuardedCollection (ICollection< T > collection)
 Wrap an ICollection<T> in a read-only wrapper More...
 
virtual int GetUnsequencedHashCode ()
 
virtual bool UnsequencedEquals (ICollection< T > that)
 
virtual bool Contains (T item)
 Check if an item is in the wrapped collection More...
 
virtual int ContainsCount (T item)
 Count the number of times an item appears in the wrapped collection More...
 
virtual ICollectionValue< T > UniqueItems ()
 
virtual ICollectionValue< KeyValuePair< T, int > > ItemMultiplicities ()
 
virtual bool ContainsAll (SCG.IEnumerable< T > items)
 Check if all items in the argument is in the wrapped collection More...
 
virtual bool Find (ref T item)
 Search for an item in the wrapped collection More...
 
virtual bool FindOrAdd (ref T item)
 
virtual bool Update (T item)
 
virtual bool Update (T item, out T olditem)
 
virtual bool UpdateOrAdd (T item)
 
virtual bool UpdateOrAdd (T item, out T olditem)
 
virtual bool Remove (T item)
 
virtual bool Remove (T item, out T removeditem)
 
virtual void RemoveAllCopies (T item)
 
virtual void RemoveAll (SCG.IEnumerable< T > items)
 
virtual void Clear ()
 
virtual void RetainAll (SCG.IEnumerable< T > items)
 
virtual bool Check ()
 Check wrapped collection for internal consistency More...
 
virtual bool Add (T item)
 
virtual void AddAll (SCG.IEnumerable< T > items)
 
- Public Member Functions inherited from C5.GuardedCollectionValue< T >
 GuardedCollectionValue (ICollectionValue< T > collectionvalue)
 Wrap a ICollectionValue<T> in a read-only wrapper More...
 
virtual void CopyTo (T[] a, int i)
 Copy the items of the wrapped collection to an array More...
 
virtual T[] ToArray ()
 Create an array from the items of the wrapped collection More...
 
virtual void Apply (Action< T > a)
 Apply a delegate to all items of the wrapped enumerable. More...
 
virtual bool Exists (Func< T, bool > filter)
 Check if there exists an item that satisfies a specific predicate in the wrapped enumerable. More...
 
virtual bool Find (Func< T, bool > filter, out T item)
 
virtual bool All (Func< T, bool > filter)
 Check if all items in the wrapped enumerable satisfies a specific predicate. More...
 
virtual SCG.IEnumerable< T > Filter (Func< T, bool > filter)
 Create an enumerable, enumerating the items of this collection that satisfies a certain condition. More...
 
virtual T Choose ()
 Choose some item of this collection. More...
 
bool Show (System.Text.StringBuilder stringbuilder, ref int rest, IFormatProvider formatProvider)
 
string ToString (string format, IFormatProvider formatProvider)
 
- Public Member Functions inherited from C5.GuardedEnumerable< T >
 GuardedEnumerable (SCG.IEnumerable< T > enumerable)
 Wrap an enumerable in a read-only wrapper More...
 
SCG.IEnumerator< T > GetEnumerator ()
 Get an enumerator from the wrapped enumerable More...
 
- Public Member Functions inherited from C5.IShowable
bool Show (StringBuilder stringbuilder, ref int rest, IFormatProvider formatProvider)
 Format More...
 
- Public Member Functions inherited from C5.ICollection< T >
new void CopyTo (T[] array, int index)
 Copy the items of this collection to a contiguous part of an array. More...
 

Properties

virtual bool IsReadOnly [get]
 (This is a read-only wrapper) More...
 
virtual Speed ContainsSpeed [get]
 
virtual bool AllowsDuplicates [get]
 
virtual SCG.IEqualityComparer< T > EqualityComparer [get]
 
virtual bool DuplicatesByCounting [get]
 By convention this is true for any collection with set semantics. More...
 
override bool IsEmpty [get]
 
- Properties inherited from C5.GuardedCollectionValue< T >
virtual EventTypeEnum ListenableEvents [get]
 The ListenableEvents value of the wrapped collection More...
 
virtual EventTypeEnum ActiveEvents [get]
 The ActiveEvents value of the wrapped collection More...
 
CollectionChangedHandler< T > CollectionChanged
 The change event. Will be raised for every change operation on the collection. More...
 
CollectionClearedHandler< T > CollectionCleared
 The change event. Will be raised for every change operation on the collection. More...
 
ItemsAddedHandler< T > ItemsAdded
 The item added event. Will be raised for every individual addition to the collection. More...
 
ItemInsertedHandler< T > ItemInserted
 The item added event. Will be raised for every individual addition to the collection. More...
 
ItemsRemovedHandler< T > ItemsRemoved
 The item removed event. Will be raised for every individual removal from the collection. More...
 
ItemRemovedAtHandler< T > ItemRemovedAt
 The item removed event. Will be raised for every individual removal from the collection. More...
 
virtual bool IsEmpty [get]
 Get the size of the wrapped collection More...
 
virtual int Count [get]
 Get the size of the wrapped collection More...
 
virtual Speed CountSpeed [get]
 The value is symbolic indicating the type of asymptotic complexity in terms of the size of this collection (worst-case or amortized as relevant). More...
 
- Properties inherited from C5.ICollectionValue< T >
EventTypeEnum ListenableEvents [get]
 A flag bitmap of the events subscribable to by this collection. More...
 
EventTypeEnum ActiveEvents [get]
 A flag bitmap of the events currently subscribed to by this collection. More...
 
bool IsEmpty [get]
 
int Count [get]
 
Speed CountSpeed [get]
 The value is symbolic indicating the type of asymptotic complexity in terms of the size of this collection (worst-case or amortized as relevant). More...
 
- Properties inherited from C5.ICollection< T >
Speed ContainsSpeed [get]
 The value is symbolic indicating the type of asymptotic complexity in terms of the size of this collection (worst-case or amortized as relevant). More...
 
new int Count [get]
 
new bool IsReadOnly [get]
 If true any call of an updating operation will throw an More...
 
- Properties inherited from C5.IExtensible< T >
bool IsReadOnly [get]
 If true any call of an updating operation will throw an More...
 
bool AllowsDuplicates [get]
 
SCG.IEqualityComparer< T > EqualityComparer [get]
 (Here should be a discussion of the role of equalityComparers. Any ). More...
 
bool DuplicatesByCounting [get]
 By convention this is true for any collection with set semantics. More...
 

Additional Inherited Members

- Events inherited from C5.ICollectionValue< T >
CollectionChangedHandler< T > CollectionChanged
 The change event. Will be raised for every change operation on the collection. More...
 
CollectionClearedHandler< T > CollectionCleared
 The change event. Will be raised for every clear operation on the collection. More...
 
ItemsAddedHandler< T > ItemsAdded
 The item added event. Will be raised for every individual addition to the collection. More...
 
ItemInsertedHandler< T > ItemInserted
 The item inserted event. Will be raised for every individual insertion to the collection. More...
 
ItemsRemovedHandler< T > ItemsRemoved
 The item removed event. Will be raised for every individual removal from the collection. More...
 
ItemRemovedAtHandler< T > ItemRemovedAt
 The item removed at event. Will be raised for every individual removal at from the collection. More...
 

Detailed Description

A read-only wrapper for an T:C5.ICollection`1,

Suitable for wrapping hash tables, T:C5.HashSet`1 and T:C5.HashBag`1

Constructor & Destructor Documentation

Wrap an ICollection<T> in a read-only wrapper

Parameters
collectionthe collection to wrap

Member Function Documentation

virtual bool C5.GuardedCollection< T >.Add ( item)
virtual

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
item
Returns

Implements C5.ICollection< T >.

virtual void C5.GuardedCollection< T >.AddAll ( SCG.IEnumerable< T >  items)
virtual

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
items

Implements C5.IExtensible< T >.

virtual bool C5.GuardedCollection< T >.Check ( )
virtual

Check wrapped collection for internal consistency

Returns
True if check passed

Implements C5.IExtensible< T >.

virtual void C5.GuardedCollection< T >.Clear ( )
virtual

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper

Implements C5.ICollection< T >.

virtual bool C5.GuardedCollection< T >.Contains ( item)
virtual

Check if an item is in the wrapped collection

Parameters
itemThe item
Returns
True if found

Implements C5.ICollection< T >.

virtual bool C5.GuardedCollection< T >.ContainsAll ( SCG.IEnumerable< T >  items)
virtual

Check if all items in the argument is in the wrapped collection

Parameters
itemsThe items
Returns
True if so

Implements C5.ICollection< T >.

virtual int C5.GuardedCollection< T >.ContainsCount ( item)
virtual

Count the number of times an item appears in the wrapped collection

Parameters
itemThe item
Returns
The number of copies

Implements C5.ICollection< T >.

virtual bool C5.GuardedCollection< T >.Find ( ref T  item)
virtual

Search for an item in the wrapped collection

Parameters
itemOn entry the item to look for, on exit the equivalent item found (if any)
Returns

Implements C5.ICollection< T >.

virtual bool C5.GuardedCollection< T >.FindOrAdd ( ref T  item)
virtual

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
item
Returns

Implements C5.ICollection< T >.

virtual int C5.GuardedCollection< T >.GetUnsequencedHashCode ( )
virtual

Returns

Implements C5.ICollection< T >.

virtual ICollectionValue<KeyValuePair<T, int> > C5.GuardedCollection< T >.ItemMultiplicities ( )
virtual

Returns

Implements C5.ICollection< T >.

virtual bool C5.GuardedCollection< T >.Remove ( item)
virtual

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
item
Returns

Implements C5.ICollection< T >.

virtual bool C5.GuardedCollection< T >.Remove ( item,
out T  removeditem 
)
virtual

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
itemThe value to remove.
removeditemThe removed value.
Returns

Implements C5.ICollection< T >.

virtual void C5.GuardedCollection< T >.RemoveAll ( SCG.IEnumerable< T >  items)
virtual

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
items

Implements C5.ICollection< T >.

virtual void C5.GuardedCollection< T >.RemoveAllCopies ( item)
virtual

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
item

Implements C5.ICollection< T >.

virtual void C5.GuardedCollection< T >.RetainAll ( SCG.IEnumerable< T >  items)
virtual

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
items

Implements C5.ICollection< T >.

virtual ICollectionValue<T> C5.GuardedCollection< T >.UniqueItems ( )
virtual

Returns

Implements C5.ICollection< T >.

virtual bool C5.GuardedCollection< T >.UnsequencedEquals ( ICollection< T >  that)
virtual

Parameters
that
Returns

Implements C5.ICollection< T >.

virtual bool C5.GuardedCollection< T >.Update ( item)
virtual

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
item
Returns

Implements C5.ICollection< T >.

virtual bool C5.GuardedCollection< T >.Update ( item,
out T  olditem 
)
virtual

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
item
olditem
Returns

Implements C5.ICollection< T >.

virtual bool C5.GuardedCollection< T >.UpdateOrAdd ( item)
virtual

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
item
Returns

Implements C5.ICollection< T >.

virtual bool C5.GuardedCollection< T >.UpdateOrAdd ( item,
out T  olditem 
)
virtual

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
item
olditem
Returns

Implements C5.ICollection< T >.

Property Documentation

virtual bool C5.GuardedCollection< T >.AllowsDuplicates
get

False if wrapped collection has set semantics

virtual Speed C5.GuardedCollection< T >.ContainsSpeed
get

Speed of wrapped collection

virtual bool C5.GuardedCollection< T >.DuplicatesByCounting
get

By convention this is true for any collection with set semantics.

True if only one representative of a group of equal items is kept in the collection together with the total count.

virtual SCG.IEqualityComparer<T> C5.GuardedCollection< T >.EqualityComparer
get

override bool C5.GuardedCollection< T >.IsEmpty
get

True if wrapped collection is empty

virtual bool C5.GuardedCollection< T >.IsReadOnly
get

(This is a read-only wrapper)

True


The documentation for this class was generated from the following file: