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

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...

Inheritance diagram for C5.GuardedList< T >:
C5.GuardedSequenced< T > C5.IList< T > C5.GuardedCollection< T > C5.ISequenced< T > C5.IIndexed< T > C5.GuardedCollectionValue< T > C5.ICollection< T > C5.ICollection< T > C5.IDirectedCollectionValue< T > C5.ISequenced< T > C5.IDirectedCollectionValue< T > C5.ICollection< T > C5.IDirectedEnumerable< T > C5.ICollectionValue< T > C5.IExtensible< T > C5.IExtensible< T > C5.ICollectionValue< T > C5.GuardedEnumerable< T >

Public Member Functions

 GuardedList (IList< T > list)
 Wrap a list in a read-only wrapper. A list gets wrapped as read-only, a list view gets wrapped as read-only and non-slidable. More...
 
void Insert (int index, T item)
 
void Insert (IList< T > pointer, T item)
 
void InsertFirst (T item)
 
void InsertLast (T item)
 
void InsertBefore (T item, T target)
 
void InsertAfter (T item, T target)
 
void InsertAll (int i, SCG.IEnumerable< T > items)
 
IList< T > FindAll (Func< T, bool > filter)
 Perform FindAll on the wrapped list. The result is not necessarily read-only. More...
 
IList< V > Map< V > (Func< T, V > mapper)
 Perform Map on the wrapped list. The result is not necessarily read-only. More...
 
IList< V > Map< V > (Func< T, V > mapper, SCG.IEqualityComparer< V > itemequalityComparer)
 Perform Map on the wrapped list. The result is not necessarily read-only. More...
 
Remove ()
 
RemoveFirst ()
 
RemoveLast ()
 
IList< T > View (int start, int count)
 Create the indicated view on the wrapped list and wrap it read-only. More...
 
IList< T > ViewOf (T item)
 Create the indicated view on the wrapped list and wrap it read-only. More...
 
IList< T > LastViewOf (T item)
 Create the indicated view on the wrapped list and wrap it read-only. More...
 
IList< T > Slide (int offset)
 
IList< T > Slide (int offset, int size)
 
bool TrySlide (int offset)
 
bool TrySlide (int offset, int size)
 
IList< T > Span (IList< T > otherView)
 
void Reverse ()
 
Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
More...
 
void Reverse (int start, int count)
 
bool IsSorted ()
 Check if wrapped list is sorted according to the default sorting order for the item type T, as defined by the T:C5.Comparer`1 class More...
 
bool IsSorted (SCG.IComparer< T > c)
 Check if wrapped list is sorted More...
 
void Sort ()
 
void Sort (SCG.IComparer< T > c)
 
void Shuffle ()
 
void Shuffle (Random rnd)
 
int IndexOf (T item)
 Find the (first) index of an item in the wrapped collection More...
 
int LastIndexOf (T item)
 Find the last index of an item in the wrapped collection More...
 
RemoveAt (int i)
 
void RemoveInterval (int start, int count)
 
void Push (T item)
 
Pop ()
 
void Enqueue (T item)
 
Dequeue ()
 
void Dispose ()
 Ignore: this may be called by a foreach or using statement. More...
 
- Public Member Functions inherited from C5.GuardedSequenced< T >
 GuardedSequenced (ISequenced< T > sorted)
 Wrap a sequenced collection in a read-only wrapper More...
 
int FindIndex (Func< T, bool > predicate)
 Check if there exists an item that satisfies a specific predicate in this collection and return the index of the first one. More...
 
int FindLastIndex (Func< T, bool > predicate)
 Check if there exists an item that satisfies a specific predicate in this collection and return the index of the last one. More...
 
int GetSequencedHashCode ()
 
bool SequencedEquals (ISequenced< T > that)
 
virtual bool FindLast (Func< T, bool > predicate, out T item)
 
- Public Member Functions inherited from C5.GuardedCollection< T >
 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 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.IList< T >
new void Clear ()
 
new bool Contains (T item)
 
new void CopyTo (T[] array, int index)
 
new bool Remove (T item)
 
- Public Member Functions inherited from C5.IIndexed< T >
int FindIndex (Func< T, bool > predicate)
 Check if there exists an item that satisfies a specific predicate in this collection and return the index of the first one. More...
 
int FindLastIndex (Func< T, bool > predicate)
 Check if there exists an item that satisfies a specific predicate in this collection and return the index of the last one. More...
 

Properties

First [get]
 
Last [get]
 
bool FIFO [get, set]
 
virtual bool IsFixedSize [get]
 
this[int i] [get, set]
 
virtual Speed IndexingSpeed [get]
 
IList< T > Underlying [get]
 
int Offset [get]
 
virtual bool IsValid [get]
 
IDirectedCollectionValue< T > this[int start, int end] [get]
 
- Properties inherited from C5.GuardedSequenced< T >
EnumerationDirection Direction [get]
 
- Properties inherited from C5.GuardedCollection< T >
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...
 
- Properties inherited from C5.IDirectedEnumerable< T >
EnumerationDirection Direction [get]
 
- Properties inherited from C5.IList< T >
First [get]
 
Last [get]
 
bool FIFO [get, set]
 Since More...
 
bool IsFixedSize [get]
 
new T this[int index] [get, set]
 On this list, this indexer is read/write. More...
 
new int Count [get]
 
new bool IsReadOnly [get]
 
IList< T > Underlying [get]
 Null if this list is not a view. More...
 
int Offset [get]
 
bool IsValid [get]
 
- Properties inherited from C5.IIndexed< T >
Speed IndexingSpeed [get]
 
IDirectedCollectionValue< T > this[int start, int count] [get]
 

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 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.

Constructor & Destructor Documentation

C5.GuardedList< T >.GuardedList ( IList< T >  list)

Wrap a list in a read-only wrapper. A list gets wrapped as read-only, a list view gets wrapped as read-only and non-slidable.

Parameters
listThe list

Member Function Documentation

T C5.GuardedList< T >.Dequeue ( )

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Returns
-
void C5.GuardedList< T >.Dispose ( )

Ignore: this may be called by a foreach or using statement.

void C5.GuardedList< T >.Enqueue ( item)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Returns
-
IList<T> C5.GuardedList< T >.FindAll ( Func< T, bool >  filter)

Perform FindAll on the wrapped list. The result is not necessarily read-only.

Parameters
filterThe filter to use
Returns

Implements C5.IList< T >.

int C5.GuardedList< T >.IndexOf ( item)

Find the (first) index of an item in the wrapped collection

Parameters
item
Returns

Implements C5.IList< T >.

void C5.GuardedList< T >.Insert ( int  index,
item 
)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
index
item
void C5.GuardedList< T >.Insert ( IList< T >  pointer,
item 
)

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

Implements C5.IList< T >.

void C5.GuardedList< T >.InsertAfter ( item,
target 
)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
item
target
void C5.GuardedList< T >.InsertAll ( int  i,
SCG.IEnumerable< T >  items 
)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
i
items

Implements C5.IList< T >.

void C5.GuardedList< T >.InsertBefore ( item,
target 
)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
item
target
void C5.GuardedList< T >.InsertFirst ( item)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
item

Implements C5.IList< T >.

void C5.GuardedList< T >.InsertLast ( item)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
item

Implements C5.IList< T >.

bool C5.GuardedList< T >.IsSorted ( )

Check if wrapped list is sorted according to the default sorting order for the item type T, as defined by the T:C5.Comparer`1 class

Exceptions
NotComparableExceptionif T is not comparable
Returns
True if the list is sorted, else false.

Implements C5.IList< T >.

bool C5.GuardedList< T >.IsSorted ( SCG.IComparer< T >  c)

Check if wrapped list is sorted

Parameters
cThe sorting order to use
Returns
True if sorted

Implements C5.IList< T >.

int C5.GuardedList< T >.LastIndexOf ( item)

Find the last index of an item in the wrapped collection

Parameters
item
Returns

Implements C5.IIndexed< T >.

IList<T> C5.GuardedList< T >.LastViewOf ( item)

Create the indicated view on the wrapped list and wrap it read-only.

Parameters
item
Returns

Implements C5.IList< T >.

IList<V> C5.GuardedList< T >.Map< V > ( Func< T, V >  mapper)

Perform Map on the wrapped list. The result is not necessarily read-only.

Template Parameters
VThe type of items of the new list
Parameters
mapperThe mapper to use.
Returns
The mapped list

Implements C5.IList< T >.

IList<V> C5.GuardedList< T >.Map< V > ( Func< T, V >  mapper,
SCG.IEqualityComparer< V >  itemequalityComparer 
)

Perform Map on the wrapped list. The result is not necessarily read-only.

Template Parameters
VThe type of items of the new list
Parameters
mapperThe delegate defining the map.
itemequalityComparerThe itemequalityComparer to use for the new list
Returns
The new list.

Implements C5.IList< T >.

T C5.GuardedList< T >.Pop ( )

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Returns
-
void C5.GuardedList< T >.Push ( item)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Returns
-
T C5.GuardedList< T >.Remove ( )

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Returns

Implements C5.IList< T >.

T C5.GuardedList< T >.RemoveAt ( int  i)

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

Implements C5.IList< T >.

T C5.GuardedList< T >.RemoveFirst ( )

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Returns

Implements C5.IList< T >.

void C5.GuardedList< T >.RemoveInterval ( int  start,
int  count 
)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
start
count

Implements C5.IIndexed< T >.

T C5.GuardedList< T >.RemoveLast ( )

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Returns

Implements C5.IList< T >.

void C5.GuardedList< T >.Reverse ( )

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper

Implements C5.IList< T >.

void C5.GuardedList< T >.Reverse ( int  start,
int  count 
)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
start
count
void C5.GuardedList< T >.Shuffle ( )

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper

Implements C5.IList< T >.

void C5.GuardedList< T >.Shuffle ( Random  rnd)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
rnd

Implements C5.IList< T >.

IList<T> C5.GuardedList< T >.Slide ( int  offset)

Exceptions
ReadOnlyCollectionExceptionif this is a wrapped view and not a view that was made on a wrapper
Parameters
offset

Implements C5.IList< T >.

IList<T> C5.GuardedList< T >.Slide ( int  offset,
int  size 
)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
offset
size

Implements C5.IList< T >.

void C5.GuardedList< T >.Sort ( )

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper

Implements C5.IList< T >.

void C5.GuardedList< T >.Sort ( SCG.IComparer< T >  c)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
c

Implements C5.IList< T >.

IList<T> C5.GuardedList< T >.Span ( IList< T >  otherView)

Parameters
otherView
Returns

Implements C5.IList< T >.

bool C5.GuardedList< T >.TrySlide ( int  offset)

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

Implements C5.IList< T >.

bool C5.GuardedList< T >.TrySlide ( int  offset,
int  size 
)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
offset
size
Returns

Implements C5.IList< T >.

IList<T> C5.GuardedList< T >.View ( int  start,
int  count 
)

Create the indicated view on the wrapped list and wrap it read-only.

Parameters
start
count
Returns

Implements C5.IList< T >.

IList<T> C5.GuardedList< T >.ViewOf ( item)

Create the indicated view on the wrapped list and wrap it read-only.

Parameters
item
Returns

Implements C5.IList< T >.

Property Documentation

bool C5.GuardedList< T >.FIFO
getset

Exceptions
ReadOnlyCollectionExceptionif used as setter

True if wrapped list has FIFO semantics for the Add(T item) and Remove() methods

T C5.GuardedList< T >.First
get

The first item of the wrapped list

virtual Speed C5.GuardedList< T >.IndexingSpeed
get

virtual bool C5.GuardedList< T >.IsFixedSize
get

virtual bool C5.GuardedList< T >.IsValid
get

T C5.GuardedList< T >.Last
get

The last item of the wrapped list

int C5.GuardedList< T >.Offset
get

The offset of the wrapped list as a view.

T C5.GuardedList< T >.this[int i]
getset

Exceptions
ReadOnlyCollectionExceptionif used as setter

The i'th item of the wrapped list

IDirectedCollectionValue<T> C5.GuardedList< T >.this[int start, int end]
get

A directed collection of the items in the indicated interval of the wrapped collection

IList<T> C5.GuardedList< T >.Underlying
get

The wrapped underlying list of the wrapped view


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