NanoByte.Common 2.10.6
NanoByte.Common.Collections.MultiDictionary< TKey, TValue > Class Template Reference

A dictionary that allows a key to reference multiple values. More...

Inheritance diagram for NanoByte.Common.Collections.MultiDictionary< TKey, TValue >:

Public Member Functions

void Add (TKey key, TValue value)
 Adds an element with the provided key and value to the dictionary. More...
 
bool Remove (TKey key, TValue value)
 Removes an element with the provided key and value from the dictionary. More...
 

Properties

new IEnumerable< TValue > Values [get]
 A collection containing the values in the dictionary.
 
new IEnumerable< TValue > this[TKey key] [get]
 Gets a collection containing the values with the specified key. More...
 

Detailed Description

A dictionary that allows a key to reference multiple values.

Template Parameters
TKeyThe type to use as a key to identify entries in the dictionary.
TValueThe type to use as elements to store in the dictionary.

This structure internally uses hash maps, so most operations run in O(1).

Type Constraints
TKey :notnull 

Member Function Documentation

◆ Add()

void NanoByte.Common.Collections.MultiDictionary< TKey, TValue >.Add ( TKey  key,
TValue  value 
)
inline

Adds an element with the provided key and value to the dictionary.

Parameters
keyThe key of the element to add.
valueThe value of the element to add.

◆ Remove()

bool NanoByte.Common.Collections.MultiDictionary< TKey, TValue >.Remove ( TKey  key,
TValue  value 
)
inline

Removes an element with the provided key and value from the dictionary.

Parameters
keyThe key of the element to remove.
valueThe value of the element to remove.
Returns
true if any elements were successfully removed; otherwise, false.

Property Documentation

◆ this[TKey key]

new IEnumerable<TValue> NanoByte.Common.Collections.MultiDictionary< TKey, TValue >.this[TKey key]
get

Gets a collection containing the values with the specified key.

Parameters
keyThe key of the element to get.
Returns
A list of elements with the specified key. Empty list if the key was not found.

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