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.GuardedDictionary< K, V > Class Template Reference

A read-only wrapper for a dictionary. More...

Inheritance diagram for C5.GuardedDictionary< K, V >:
C5.IDictionary< K, V > C5.GuardedSortedDictionary< K, V >

Public Member Functions

 GuardedDictionary (IDictionary< K, V > dict)
 Wrap a dictionary in a read-only wrapper More...
 
void Add (K key, V val)
 
void AddAll< L, W > (SCG.IEnumerable< KeyValuePair< L, W >> items)
 
bool Remove (K key)
 
bool Remove (K key, out V val)
 
void Clear ()
 
bool Contains (K key)
 Check if the wrapped dictionary contains a specific key More...
 
bool ContainsAll< H > (SCG.IEnumerable< H > keys)
 
bool Find (ref K key, out V val)
 Search for a key in the wrapped dictionary, reporting the value if found More...
 
bool Update (K key, V val)
 
bool Update (K key, V val, out V oldval)
 
bool FindOrAdd (K key, ref V val)
 
bool UpdateOrAdd (K key, V val)
 
bool UpdateOrAdd (K key, V val, out V oldval)
 
bool Check ()
 Check the internal consistency of the wrapped dictionary More...
 
- Public Member Functions inherited from C5.IDictionary< K, V >
void AddAll< U, W > (SCG.IEnumerable< KeyValuePair< U, W >> entries)
 Add the entries from a collection of T:C5.KeyValuePair`2 pairs to this dictionary. More...
 

Properties

SCG.IEqualityComparer< K > EqualityComparer [get]
 
this[K key] [get, set]
 
bool IsReadOnly [get]
 (This is a read-only wrapper) More...
 
ICollectionValue< K > Keys [get]
 
ICollectionValue< V > Values [get]
 
virtual Func< K, V > Func [get]
 
Speed ContainsSpeed [get]
 
- Properties inherited from C5.IDictionary< K, V >
SCG.IEqualityComparer< K > EqualityComparer [get]
 The key equalityComparer. More...
 
this[K key] [get, set]
 Indexer for dictionary. More...
 
bool IsReadOnly [get]
 
ICollectionValue< K > Keys [get]
 
ICollectionValue< V > Values [get]
 
Func< K, V > Func [get]
 
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...
 

Detailed Description

A read-only wrapper for a dictionary.

Suitable for wrapping a HashDictionary. T:C5.HashDictionary`2

Constructor & Destructor Documentation

Wrap a dictionary in a read-only wrapper

Parameters
dictthe dictionary

Member Function Documentation

void C5.GuardedDictionary< K, V >.Add ( key,
val 
)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
key
val

Implements C5.IDictionary< K, V >.

void C5.GuardedDictionary< K, V >.AddAll< L, W > ( SCG.IEnumerable< KeyValuePair< L, W >>  items)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
items
Type Constraints
L :K 
W :V 
bool C5.GuardedDictionary< K, V >.Check ( )

Check the internal consistency of the wrapped dictionary

Returns
True if check passed

Implements C5.IDictionary< K, V >.

void C5.GuardedDictionary< K, V >.Clear ( )

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper

Implements C5.IDictionary< K, V >.

bool C5.GuardedDictionary< K, V >.Contains ( key)

Check if the wrapped dictionary contains a specific key

Parameters
keyThe key
Returns
True if it does

Implements C5.IDictionary< K, V >.

bool C5.GuardedDictionary< K, V >.ContainsAll< H > ( SCG.IEnumerable< H >  keys)

Parameters
keys
Returns

Implements C5.IDictionary< K, V >.

Type Constraints
H :K 
bool C5.GuardedDictionary< K, V >.Find ( ref K  key,
out V  val 
)

Search for a key in the wrapped dictionary, reporting the value if found

Parameters
keyThe key
valOn exit: the value if found
Returns
True if found

Implements C5.IDictionary< K, V >.

bool C5.GuardedDictionary< K, V >.FindOrAdd ( key,
ref V  val 
)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
key
val
Returns

Implements C5.IDictionary< K, V >.

bool C5.GuardedDictionary< K, V >.Remove ( key)

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

Implements C5.IDictionary< K, V >.

bool C5.GuardedDictionary< K, V >.Remove ( key,
out V  val 
)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
key
val
Returns

Implements C5.IDictionary< K, V >.

bool C5.GuardedDictionary< K, V >.Update ( key,
val 
)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
key
val
Returns

Implements C5.IDictionary< K, V >.

bool C5.GuardedDictionary< K, V >.Update ( key,
val,
out V  oldval 
)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
key
val
oldval
Returns

Implements C5.IDictionary< K, V >.

bool C5.GuardedDictionary< K, V >.UpdateOrAdd ( key,
val 
)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
key
val
Returns

Implements C5.IDictionary< K, V >.

bool C5.GuardedDictionary< K, V >.UpdateOrAdd ( key,
val,
out V  oldval 
)

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper
Parameters
key
val
oldval
Returns

Implements C5.IDictionary< K, V >.

Property Documentation

Speed C5.GuardedDictionary< K, V >.ContainsSpeed
get

SCG.IEqualityComparer<K> C5.GuardedDictionary< K, V >.EqualityComparer
get

virtual Func<K, V> C5.GuardedDictionary< K, V >.Func
get

bool C5.GuardedDictionary< K, V >.IsReadOnly
get

(This is a read-only wrapper)

True

The collection of keys of the wrapped dictionary

V C5.GuardedDictionary< K, V >.this[K key]
getset

Exceptions
ReadOnlyCollectionExceptionsince this is a read-only wrapper if used as a setter

Get the value corresponding to a key in the wrapped dictionary

ICollectionValue<V> C5.GuardedDictionary< K, V >.Values
get

The collection of values of the wrapped dictionary


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