Provides a mechanism to merge multiple dictionaries into one Source dictionaries.
More...
|
| MergeDictionary (params IDictionary< TKey, TValue >[] layers) |
| Construct MergeDictionary over other dictionaries.
|
IEnumerator< KeyValuePair< TKey, TValue > > | GetEnumerator () |
| Gets an Enumerator for the KeyValuePairs in this merged dictionary, prioritised by the order of provided layers.
|
void | Add (KeyValuePair< TKey, TValue > item) |
| Will throw - MergeDictionary is read-only.
|
void | Clear () |
| Will throw - MergeDictionary is read-only.
|
bool | Contains (KeyValuePair< TKey, TValue > item) |
| Returns true if any layer contains the provided item.
|
void | CopyTo (KeyValuePair< TKey, TValue >[] array, int arrayIndex) |
| Copies the prioritised items to the provided array from the given arrayIndex.
|
bool | Remove (KeyValuePair< TKey, TValue > item) |
| Will throw an exception - MergeDictionary is read-only.
|
bool | ContainsKey (TKey key) |
| Searches for the given key across all layers.
|
void | Add (TKey key, TValue value) |
| Will throw - MergeDictionaries are read-only.
|
bool | Remove (TKey key) |
| Will throw - MergeDictionaries are read-only.
|
bool | TryGetValue (TKey key, out TValue value) |
| Tries to get a value by key from the underlying layers.
|
void | AppendLayer (IDictionary< TKey, TValue > layer) |
| Append a layer to the collection.
|
void | InsertLayer (IDictionary< TKey, TValue > layer) |
| Insert a layer at the top of the stack.
|
void | InsertLayer (int idx, IDictionary< TKey, TValue > layer) |
| Insert a layer at the provided index - see LayerCount for the valid range.
|
|
IEqualityComparer< TKey > | Comparer [get] |
| Expose the first (or least-restrictive, for strings) key comparer.
|
int | Count [get] |
| Returns the count of distinct keys.
|
bool | IsReadOnly [get] |
| Will return true: MergeDictionaries are read-only.
|
TValue | this[TKey key] [get, set] |
| Index into the layers to find the highest-priority match for the provided key.
|
ICollection< TKey > | Keys [get] |
| Returns a collection of the distinct keys in all layers.
|
ICollection< TValue > | Values [get] |
| Returns a collection of ALL values in all layers.
|
int | LayerCount [get] |
| Reflects the number of layers in this merged dictionary.
|
Provides a mechanism to merge multiple dictionaries into one Source dictionaries.
- Template Parameters
-
◆ Add() [1/2]
void PeanutButter.Utils.Dictionaries.MergeDictionary< TKey, TValue >.Add |
( |
KeyValuePair< TKey, TValue > | item | ) |
|
Will throw - MergeDictionary is read-only.
- Parameters
-
- Exceptions
-
InvalidOperationException | |
◆ Add() [2/2]
void PeanutButter.Utils.Dictionaries.MergeDictionary< TKey, TValue >.Add |
( |
TKey | key, |
|
|
TValue | value ) |
Will throw - MergeDictionaries are read-only.
- Parameters
-
- Exceptions
-
InvalidOperationException | |
◆ AppendLayer()
void PeanutButter.Utils.Dictionaries.MergeDictionary< TKey, TValue >.AppendLayer |
( |
IDictionary< TKey, TValue > | layer | ) |
|
Append a layer to the collection.
- being the lowest layer, only values which are not overridden by a higher layer will reflect
- Parameters
-
◆ Clear()
void PeanutButter.Utils.Dictionaries.MergeDictionary< TKey, TValue >.Clear |
( |
| ) |
|
Will throw - MergeDictionary is read-only.
- Exceptions
-
InvalidOperationException | |
◆ Contains()
bool PeanutButter.Utils.Dictionaries.MergeDictionary< TKey, TValue >.Contains |
( |
KeyValuePair< TKey, TValue > | item | ) |
|
Returns true if any layer contains the provided item.
- Parameters
-
- Returns
- True if found, False if not
◆ ContainsKey()
bool PeanutButter.Utils.Dictionaries.MergeDictionary< TKey, TValue >.ContainsKey |
( |
TKey | key | ) |
|
Searches for the given key across all layers.
- Parameters
-
- Returns
- True if found, False otherwise
◆ CopyTo()
void PeanutButter.Utils.Dictionaries.MergeDictionary< TKey, TValue >.CopyTo |
( |
KeyValuePair< TKey, TValue >[] | array, |
|
|
int | arrayIndex ) |
Copies the prioritised items to the provided array from the given arrayIndex.
- Parameters
-
array | Target array to copy to |
arrayIndex | Index to start copying at |
◆ GetEnumerator()
IEnumerator< KeyValuePair< TKey, TValue > > PeanutButter.Utils.Dictionaries.MergeDictionary< TKey, TValue >.GetEnumerator |
( |
| ) |
|
Gets an Enumerator for the KeyValuePairs in this merged dictionary, prioritised by the order of provided layers.
- Returns
◆ InsertLayer() [1/2]
void PeanutButter.Utils.Dictionaries.MergeDictionary< TKey, TValue >.InsertLayer |
( |
IDictionary< TKey, TValue > | layer | ) |
|
Insert a layer at the top of the stack.
- Parameters
-
◆ InsertLayer() [2/2]
void PeanutButter.Utils.Dictionaries.MergeDictionary< TKey, TValue >.InsertLayer |
( |
int | idx, |
|
|
IDictionary< TKey, TValue > | layer ) |
Insert a layer at the provided index - see LayerCount for the valid range.
- Parameters
-
◆ MergeDictionary()
PeanutButter.Utils.Dictionaries.MergeDictionary< TKey, TValue >.MergeDictionary |
( |
params IDictionary< TKey, TValue >[] | layers | ) |
|
Construct MergeDictionary over other dictionaries.
- Parameters
-
◆ Remove() [1/2]
bool PeanutButter.Utils.Dictionaries.MergeDictionary< TKey, TValue >.Remove |
( |
KeyValuePair< TKey, TValue > | item | ) |
|
Will throw an exception - MergeDictionary is read-only.
- Parameters
-
- Returns
- Exceptions
-
InvalidOperationException | |
◆ Remove() [2/2]
bool PeanutButter.Utils.Dictionaries.MergeDictionary< TKey, TValue >.Remove |
( |
TKey | key | ) |
|
Will throw - MergeDictionaries are read-only.
- Parameters
-
- Returns
- Exceptions
-
InvalidOperationException | |
◆ TryGetValue()
bool PeanutButter.Utils.Dictionaries.MergeDictionary< TKey, TValue >.TryGetValue |
( |
TKey | key, |
|
|
out TValue | value ) |
Tries to get a value by key from the underlying layers.
- Parameters
-
key | Key to search for |
value | Value to search for |
- Returns
- True if found, False otherwise
◆ this[TKey key]
TValue PeanutButter.Utils.Dictionaries.MergeDictionary< TKey, TValue >.this[TKey key] |
|
getset |
Index into the layers to find the highest-priority match for the provided key.
- Parameters
-
The documentation for this class was generated from the following file:
- source/Utils/PeanutButter.Utils/Dictionaries/MergeDictionary.cs