Class ListDictionary<TKey, TValue>
Represents a collection of keys mapped to a list of values per key.
Implements
Inherited Members
Namespace: Singulink.Collections
Assembly: Singulink.Collections.dll
Syntax
public class ListDictionary<TKey, TValue> : IListDictionary<TKey, TValue>, ICollectionDictionary<TKey, TValue, IList<TValue>>, IReadOnlyDictionary<TKey, IList<TValue>>, IReadOnlyCollection<KeyValuePair<TKey, IList<TValue>>>, ICollection<KeyValuePair<TKey, IList<TValue>>>, IEnumerable<KeyValuePair<TKey, IList<TValue>>>, IEnumerable where TKey : notnull
Type Parameters
Name | Description |
---|---|
TKey | The type of the keys in the dictionary. |
TValue | The type of the values in the dictionary. |
Constructors
Name | Description |
---|---|
ListDictionary() | Initializes a new instance of the ListDictionary<TKey, TValue> class. |
ListDictionary(IEqualityComparer<TKey>?) | Initializes a new instance of the ListDictionary<TKey, TValue> class that uses the specified key comparer. |
ListDictionary(int) | Initializes a new instance of the ListDictionary<TKey, TValue> class with the specified initial capacity for key/value list pairs. |
ListDictionary(int, IEqualityComparer<TKey>?) | Initializes a new instance of the ListDictionary<TKey, TValue> class with the specified initial capacity for key/value list pairs, and uses the specified key comparer. |
Properties
Name | Description |
---|---|
Count | Gets the number of keys and associated value lists in the dictionary. |
this[TKey] | Gets the value set associated with the specified key. If the key is not found then a new value set is returned which can be used to add values to the key or to monitor when items are added to the key. |
KeyComparer | Gets the comparer that is used to determine equality of the keys. |
Keys | Gets a collection containing the keys in the dictionary. |
ValueCount | Gets the number of values in the dictionary across all keys. |
ValueLists | Gets a collection containing the value lists in the dictionary. |
Values | Gets a collection containing all the values in the dictionary across all the keys. |
Methods
Name | Description |
---|---|
Clear() | Clears all keys and values from the dictionary and associated value lists. |
Clear(TKey) | Clears the values in the list associated with the specified key and removes the key from the dictionary. |
Contains(TKey, TValue) | Returns a value indicating whether the specified key and associated value are present in the dictionary. |
ContainsKey(TKey) | Returns a value indicating whether the dictionary contains the specified key. |
ContainsValue(TValue) | Returns a value indicating whether any of the value lists in the dictionary contain the specified value. |
EnsureCapacity(int) | Ensures that the dictionary can hold up to a specified number of key/value list pairs without any further expansion of its backing storage. |
GetEnumerator() | Returns an enumerator that iterates through the value lists in the dictionary. |
GetValueCount(TKey) | Gets the number of values in the dictionary associated with the specified key or zero if the key is not present. |
TrimExcess(bool) | Sets the key/value list pair capacity of this dictionary to what it would be if it had been originally initialized with all its entries, and optionally sets the capacity of each value list to the actual number of values in the list. |
TrimExcess(int, bool) | Sets the key/value list pair capacity of this dictionary to hold up a specified number of entries without any further expansion of its backing storage, and optionally trims the capacity of each value list to the actual number of values in the list. |
TryGetValues(TKey, out ValueList) | Gets the values for the specified key. |
Explicit Interface Implementations
Name | Description |
---|---|
ICollectionDictionary<TKey, TValue, IList<TValue>>.this[TKey] | Gets the value set associated with the specified key. If the key is not found then a new value set is returned which can be used to add values to the key or to monitor when items are added to the key. |
ICollectionDictionary<TKey, TValue, IList<TValue>>.Keys | Gets a collection containing the keys in the dictionary. |
ICollectionDictionary<TKey, TValue, IList<TValue>>.TryGetValues(TKey, out IList<TValue>) | Gets the values for the specified key. |
ICollectionDictionary<TKey, TValue, IList<TValue>>.ValueCollections | Gets a collection containing the value lists in the dictionary. |
ICollectionDictionary<TKey, TValue, IList<TValue>>.Values | Gets a collection containing all the values in the dictionary across all the keys. |
ICollection<KeyValuePair<TKey, IList<TValue>>>.Add(KeyValuePair<TKey, IList<TValue>>) | Not supported. |
ICollection<KeyValuePair<TKey, IList<TValue>>>.Clear() | Not supported. |
ICollection<KeyValuePair<TKey, IList<TValue>>>.Contains(KeyValuePair<TKey, IList<TValue>>) | Gets a value indicating whether the specified key and value list is present in the dictionary. |
ICollection<KeyValuePair<TKey, IList<TValue>>>.CopyTo(KeyValuePair<TKey, IList<TValue>>[], int) | Copies the key and value list pairs to an array starting at the given array index. |
ICollection<KeyValuePair<TKey, IList<TValue>>>.IsReadOnly | Gets a value indicating whether this collection is read-only. Although this dictionary is not read-only, this always returns true as only read operations are supported through the ICollection<T> interface. |
ICollection<KeyValuePair<TKey, IList<TValue>>>.Remove(KeyValuePair<TKey, IList<TValue>>) | Not supported. |
IEnumerable<KeyValuePair<TKey, IList<TValue>>>.GetEnumerator() | Returns an enumerator that iterates through the value lists in the dictionary. |
IReadOnlyDictionary<TKey, IList<TValue>>.this[TKey] | Gets the value set associated with the specified key. If the key is not found then a new value set is returned which can be used to add values to the key or to monitor when items are added to the key. |
IReadOnlyDictionary<TKey, IList<TValue>>.Keys | Gets a collection containing the keys in the dictionary. |
IReadOnlyDictionary<TKey, IList<TValue>>.TryGetValue(TKey, out IList<TValue>) | Gets the values for the specified key. |
IReadOnlyDictionary<TKey, IList<TValue>>.Values | Gets a collection containing the value lists in the dictionary. |
IEnumerable.GetEnumerator() | Returns an enumerator that iterates through the value lists in the dictionary. |