NetTopologySuite
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
Wintellect.PowerCollections.ReadOnlyDictionaryBase< TKey, TValue > Class Template Referenceabstract

ReadOnlyDictionaryBase is a base class that can be used to more easily implement the generic IDictionary<T> and non-generic IDictionary interfaces. More...

Inheritance diagram for Wintellect.PowerCollections.ReadOnlyDictionaryBase< TKey, TValue >:
Wintellect.PowerCollections.ReadOnlyCollectionBase< T >

Public Member Functions

virtual bool Remove (TKey key)
 Removes a key from the dictionary. Always throws an exception indicating that this method is not supported in a read-only dictionary. More...
 
virtual bool ContainsKey (TKey key)
 Determines whether a given key is found in the dictionary. More...
 
abstract bool TryGetValue (TKey key, out TValue value)
 Determines if this dictionary contains a key equal to key . If so, the value associated with that key is returned through the value parameter. This method must be overridden in the derived class. More...
 
override string ToString ()
 Shows the string representation of the dictionary. The string representation contains a list of the mappings in the dictionary. More...
 
override bool Contains (KeyValuePair< TKey, TValue > item)
 Determines if a dictionary contains a given KeyValuePair. This implementation checks to see if the dictionary contains the given key, and if the value associated with the key is equal to (via object.Equals) the value. More...
 
- Public Member Functions inherited from Wintellect.PowerCollections.ReadOnlyCollectionBase< T >
override string ToString ()
 Shows the string representation of the collection. The string representation contains a list of the items in the collection. More...
 
virtual bool Exists (Predicate< T > predicate)
 Determines if the collection contains any item that satisfies the condition defined by predicate . More...
 
virtual bool TrueForAll (Predicate< T > predicate)
 Determines if all of the items in the collection satisfy the condition defined by predicate . More...
 
virtual int CountWhere (Predicate< T > predicate)
 Counts the number of items in the collection that satisfy the condition defined by predicate . More...
 
IEnumerable< T > FindAll (Predicate< T > predicate)
 Enumerates the items in the collection that satisfy the condition defined by predicate . More...
 
virtual void ForEach (Action< T > action)
 Performs the specified action on each item in this collection. More...
 
virtual IEnumerable< TOutput > ConvertAll< TOutput > (Converter< T, TOutput > converter)
 Convert this collection of items by applying a delegate to each item in the collection. The resulting enumeration contains the result of applying converter to each item in this collection, in order. More...
 
virtual bool Contains (T item)
 Determines if the collection contains a particular item. This default implementation iterates all of the items in the collection via GetEnumerator, testing each item against item using IComparable<T>.Equals or Object.Equals. More...
 
virtual void CopyTo (T[] array, int arrayIndex)
 Copies all the items in the collection into an array. Implemented by using the enumerator returned from GetEnumerator to get all the items and copy them to the provided array. More...
 
virtual T[] ToArray ()
 Creates an array of the correct size, and copies all the items in the collection into the array, by calling CopyTo. More...
 

Protected Member Functions

 ReadOnlyDictionaryBase ()
 Creates a new DictionaryBase. This must be called from the constructor of the derived class to specify whether the dictionary is read-only and the name of the collection. More...
 
- Protected Member Functions inherited from Wintellect.PowerCollections.ReadOnlyCollectionBase< T >
 ReadOnlyCollectionBase ()
 Creates a new ReadOnlyCollectionBase. More...
 

Properties

virtual TValue this[TKey key] [get, set]
 The indexer of the dictionary. The set accessor throws an NotSupportedException stating the dictionary is read-only. More...
 
virtual ICollection< TKey > Keys [get]
 Returns a collection of the keys in this dictionary. More...
 
virtual ICollection< TValue > Values [get]
 Returns a collection of the values in this dictionary. The ordering of values in this collection is the same as that in the Keys collection. More...
 
- Properties inherited from Wintellect.PowerCollections.ReadOnlyCollectionBase< T >
abstract int Count [get]
 Must be overridden to provide the number of items in the collection. More...
 

Detailed Description

ReadOnlyDictionaryBase is a base class that can be used to more easily implement the generic IDictionary<T> and non-generic IDictionary interfaces.

To use ReadOnlyDictionaryBase as a base class, the derived class must override Count, TryGetValue, GetEnumerator.

Template Parameters
TKeyThe key type of the dictionary.
TValueThe value type of the dictionary.

Constructor & Destructor Documentation

Wintellect.PowerCollections.ReadOnlyDictionaryBase< TKey, TValue >.ReadOnlyDictionaryBase ( )
protected

Creates a new DictionaryBase. This must be called from the constructor of the derived class to specify whether the dictionary is read-only and the name of the collection.

Member Function Documentation

override bool Wintellect.PowerCollections.ReadOnlyDictionaryBase< TKey, TValue >.Contains ( KeyValuePair< TKey, TValue >  item)

Determines if a dictionary contains a given KeyValuePair. This implementation checks to see if the dictionary contains the given key, and if the value associated with the key is equal to (via object.Equals) the value.

Parameters
itemA KeyValuePair containing the Key and Value to check for.
Returns
virtual bool Wintellect.PowerCollections.ReadOnlyDictionaryBase< TKey, TValue >.ContainsKey ( TKey  key)
virtual

Determines whether a given key is found in the dictionary.

The default implementation simply calls TryGetValue and returns what it returns.

Parameters
keyKey to look for in the dictionary.
Returns
True if the key is present in the dictionary.
virtual bool Wintellect.PowerCollections.ReadOnlyDictionaryBase< TKey, TValue >.Remove ( TKey  key)
virtual

Removes a key from the dictionary. Always throws an exception indicating that this method is not supported in a read-only dictionary.

Parameters
keyKey to remove from the dictionary.
Returns
True if the key was found, false otherwise.
Exceptions
NotSupportedExceptionAlways thrown.
override string Wintellect.PowerCollections.ReadOnlyDictionaryBase< TKey, TValue >.ToString ( )

Shows the string representation of the dictionary. The string representation contains a list of the mappings in the dictionary.

Returns
The string representation of the dictionary.
abstract bool Wintellect.PowerCollections.ReadOnlyDictionaryBase< TKey, TValue >.TryGetValue ( TKey  key,
out TValue  value 
)
pure virtual

Determines if this dictionary contains a key equal to key . If so, the value associated with that key is returned through the value parameter. This method must be overridden in the derived class.

Parameters
keyThe key to search for.
valueReturns the value associated with key, if true was returned.
Returns
True if the dictionary contains key. False if the dictionary does not contain key.

Property Documentation

virtual ICollection<TKey> Wintellect.PowerCollections.ReadOnlyDictionaryBase< TKey, TValue >.Keys
get

Returns a collection of the keys in this dictionary.

A read-only collection of the keys in this dictionary.

virtual TValue Wintellect.PowerCollections.ReadOnlyDictionaryBase< TKey, TValue >.this[TKey key]
getset

The indexer of the dictionary. The set accessor throws an NotSupportedException stating the dictionary is read-only.

The get accessor is implemented by calling TryGetValue.

Parameters
keyKey to find in the dictionary.
Returns
The value associated with the key.
Exceptions
NotSupportedExceptionAlways thrown from the set accessor, indicating that the dictionary is read only.
KeyNotFoundExceptionThrown from the get accessor if the key was not found.
virtual ICollection<TValue> Wintellect.PowerCollections.ReadOnlyDictionaryBase< TKey, TValue >.Values
get

Returns a collection of the values in this dictionary. The ordering of values in this collection is the same as that in the Keys collection.

A read-only collection of the values in this dictionary.


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