NetTopologySuite
|
DictionaryBase is a base class that can be used to more easily implement the generic IDictionary<T> and non-generic IDictionary interfaces. More...
Public Member Functions | |
abstract override void | Clear () |
Clears the dictionary. This method must be overridden in the derived class. More... | |
abstract bool | Remove (TKey key) |
Removes a key from the dictionary. This method must be overridden in the derived class. 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 by the derived class. More... | |
virtual void | Add (TKey key, TValue value) |
Adds a new key-value pair to the dictionary. More... | |
virtual bool | ContainsKey (TKey key) |
Determines whether a given key is found in the dictionary. More... | |
override string | ToString () |
Shows the string representation of the dictionary. The string representation contains a list of the mappings in the dictionary. More... | |
virtual new IDictionary< TKey, TValue > | AsReadOnly () |
Provides a read-only view of this dictionary. The returned IDictionary<TKey,TValue> provides a view of the dictionary that prevents modifications to the dictionary. Use the method to provide access to the dictionary without allowing changes. Since the returned object is just a view, changes to the dictionary will be reflected in the view. More... | |
override void | Add (KeyValuePair< TKey, TValue > item) |
Adds a key-value pair to the collection. This implementation calls the Add method with the Key and Value from the item. 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... | |
override bool | Remove (KeyValuePair< TKey, TValue > item) |
Determines if a dictionary contains a given KeyValuePair, and if so, removes it. 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. If so, the key-value pair is removed. More... | |
![]() | |
override string | ToString () |
Shows the string representation of the collection. The string representation contains a list of the items in the collection. Contained collections (except string) are expanded recursively. More... | |
Protected Member Functions | |
DictionaryBase () | |
Creates a new DictionaryBase. More... | |
![]() | |
CollectionBase () | |
Creates a new CollectionBase. More... | |
Properties | |
virtual TValue | this[TKey key] [get, set] |
The indexer of the dictionary. This is used to store keys and values and retrieve values from the dictionary. The setter accessor must be overridden in the derived class. 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... | |
DictionaryBase is a base class that can be used to more easily implement the generic IDictionary<T> and non-generic IDictionary interfaces.
To use DictionaryBase as a base class, the derived class must override Count, GetEnumerator, TryGetValue, Clear, Remove, and the indexer set accessor.
TKey | The key type of the dictionary. |
TValue | The value type of the dictionary. |
|
protected |
Creates a new DictionaryBase.
|
virtual |
Adds a new key-value pair to the dictionary.
The default implementation of this method checks to see if the key already exists using ContainsKey, then calls the indexer setter if the key doesn't already exist.
key | Key to add. |
value | Value to associated with the key. |
ArgumentException | key is already present in the dictionary |
Reimplemented in Wintellect.PowerCollections.OrderedDictionary< TKey, TValue >.
override void Wintellect.PowerCollections.DictionaryBase< TKey, TValue >.Add | ( | KeyValuePair< TKey, TValue > | item | ) |
Adds a key-value pair to the collection. This implementation calls the Add method with the Key and Value from the item.
item | A KeyValuePair contains the Key and Value to add. |
|
virtual |
Provides a read-only view of this dictionary. The returned IDictionary<TKey,TValue> provides a view of the dictionary that prevents modifications to the dictionary. Use the method to provide access to the dictionary without allowing changes. Since the returned object is just a view, changes to the dictionary will be reflected in the view.
|
pure virtual |
Clears the dictionary. This method must be overridden in the derived class.
Implemented in Wintellect.PowerCollections.OrderedDictionary< TKey, TValue >.View, and Wintellect.PowerCollections.OrderedDictionary< TKey, TValue >.
override bool Wintellect.PowerCollections.DictionaryBase< 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.
item | A KeyValuePair containing the Key and Value to check for. |
|
virtual |
Determines whether a given key is found in the dictionary.
The default implementation simply calls TryGetValue and returns what it returns.
key | Key to look for in the dictionary. |
Reimplemented in Wintellect.PowerCollections.OrderedDictionary< TKey, TValue >.View, and Wintellect.PowerCollections.OrderedDictionary< TKey, TValue >.
|
pure virtual |
Removes a key from the dictionary. This method must be overridden in the derived class.
key | Key to remove from the dictionary. |
Implemented in Wintellect.PowerCollections.OrderedDictionary< TKey, TValue >.View, and Wintellect.PowerCollections.OrderedDictionary< TKey, TValue >.
override bool Wintellect.PowerCollections.DictionaryBase< TKey, TValue >.Remove | ( | KeyValuePair< TKey, TValue > | item | ) |
Determines if a dictionary contains a given KeyValuePair, and if so, removes it. 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. If so, the key-value pair is removed.
item | A KeyValuePair containing the Key and Value to check for. |
override string Wintellect.PowerCollections.DictionaryBase< TKey, TValue >.ToString | ( | ) |
Shows the string representation of the dictionary. The string representation contains a list of the mappings in the dictionary.
|
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 by the derived class.
key | The key to search for. |
value | Returns the value associated with key, if true was returned. |
Implemented in Wintellect.PowerCollections.OrderedDictionary< TKey, TValue >.View, and Wintellect.PowerCollections.OrderedDictionary< TKey, TValue >.
|
get |
Returns a collection of the keys in this dictionary.
A read-only collection of the keys in this dictionary.
|
getset |
The indexer of the dictionary. This is used to store keys and values and retrieve values from the dictionary. The setter accessor must be overridden in the derived class.
key | Key to find in the dictionary. |
KeyNotFoundException | Thrown from the get accessor if the key was not found in the dictionary. |
|
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.