Class HashSetDictionary<TKey, TValue>
Represents a collection of keys mapped to a hash set of unique values per key.
Implements
Inherited Members
Namespace: Singulink.Collections
Assembly: Singulink.Collections.dll
Syntax
public class HashSetDictionary<TKey, TValue> : ISetDictionary<TKey, TValue>, ICollectionDictionary<TKey, TValue, ISet<TValue>>, IReadOnlyDictionary<TKey, ISet<TValue>>, IReadOnlyCollection<KeyValuePair<TKey, ISet<TValue>>>, ICollection<KeyValuePair<TKey, ISet<TValue>>>, IEnumerable<KeyValuePair<TKey, ISet<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 |
---|---|
HashSetDictionary() | Initializes a new instance of the HashSetDictionary<TKey, TValue> class. |
HashSetDictionary(IEqualityComparer<TKey>?, IEqualityComparer<TValue>?) | Initializes a new instance of the HashSetDictionary<TKey, TValue> class that uses the specified key and value comparers. |
HashSetDictionary(int) | Initializes a new instance of the HashSetDictionary<TKey, TValue> class with the specified initial capacity for key/value set pairs. |
HashSetDictionary(int, IEqualityComparer<TKey>?, IEqualityComparer<TValue>?) | Initializes a new instance of the HashSetDictionary<TKey, TValue> class with the specified initial capacity for key/value set pairs, and uses the specified key and value comparers. |
Properties
Name | Description |
---|---|
Count | Gets the number of keys and associated value sets in the dictionary. |
this[TKey] | Gets the value list associated with the specified key. If the key is not found then a new value list 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. |
ValueComparer | Gets the comparer that is used to determine equality of the values. |
ValueCount | Gets the number of values in the dictionary across all keys. |
ValueSets | Gets a collection containing the value sets 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 sets. |
Clear(TKey) | Clears the values in the set 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 sets in the dictionary contain the specified value. |
EnsureCapacity(int) | Ensures that the dictionary can hold up to a specified number of key/value set pairs without any further expansion of its backing storage. |
GetEnumerator() | Returns an enumerator that iterates through the value sets 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 set pair capacity of this dictionary to what it would be if it had been originally initialized with all its entries, and optionally trims all the value sets in the dictionary as well. |
TrimExcess(int, bool) | Sets the key/value set pair capacity of this dictionary to hold up to a specified number of entries without any further expansion of its backing storage, and optionally trims the capacity of each value set to the actual number of values in the list. |
TryGetValues(TKey, out ValueSet) | Gets the value set for the specified key or null if the key was not found. |
Explicit Interface Implementations
Name | Description |
---|---|
ICollectionDictionary<TKey, TValue, ISet<TValue>>.this[TKey] | Gets the value list associated with the specified key. If the key is not found then a new value list 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, ISet<TValue>>.Keys | Gets a collection containing the keys in the dictionary. |
ICollectionDictionary<TKey, TValue, ISet<TValue>>.TryGetValues(TKey, out ISet<TValue>) | Gets the value set for the specified key or null if the key was not found. |
ICollectionDictionary<TKey, TValue, ISet<TValue>>.ValueCollections | Gets a collection containing the value sets in the dictionary. |
ICollectionDictionary<TKey, TValue, ISet<TValue>>.Values | Gets a collection containing all the values in the dictionary across all the keys. |
ICollection<KeyValuePair<TKey, ISet<TValue>>>.Add(KeyValuePair<TKey, ISet<TValue>>) | Not supported. |
ICollection<KeyValuePair<TKey, ISet<TValue>>>.Clear() | Not supported. |
ICollection<KeyValuePair<TKey, ISet<TValue>>>.Contains(KeyValuePair<TKey, ISet<TValue>>) | Gets a value indicating whether the specified key and value set is present in the dictionary. |
ICollection<KeyValuePair<TKey, ISet<TValue>>>.CopyTo(KeyValuePair<TKey, ISet<TValue>>[], int) | Copies the key and value set pairs to an array starting at the given array index. |
ICollection<KeyValuePair<TKey, ISet<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, ISet<TValue>>>.Remove(KeyValuePair<TKey, ISet<TValue>>) | Not supported. |
IEnumerable<KeyValuePair<TKey, ISet<TValue>>>.GetEnumerator() | Returns an enumerator that iterates through the value sets in the dictionary. |
IReadOnlyDictionary<TKey, ISet<TValue>>.this[TKey] | Gets the value list associated with the specified key. If the key is not found then a new value list is returned which can be used to add values to the key or to monitor when items are added to the key. |
IReadOnlyDictionary<TKey, ISet<TValue>>.Keys | Gets a collection containing the keys in the dictionary. |
IReadOnlyDictionary<TKey, ISet<TValue>>.TryGetValue(TKey, out ISet<TValue>) | Gets the value set for the specified key or null if the key was not found. |
IReadOnlyDictionary<TKey, ISet<TValue>>.Values | Gets a collection containing the value sets in the dictionary. |
IEnumerable.GetEnumerator() | Returns an enumerator that iterates through the value sets in the dictionary. |