Collections Collections
Collections Collections
DocFX + Singulink = ♥

Search Results for

    Class ListDictionary<TKey, TValue>

    Represents a collection of keys mapped to a list of values per key.

    Inheritance
    object
    ListDictionary<TKey, TValue>
    Implements
    IListDictionary<TKey, TValue>
    ICollectionDictionary<TKey, TValue, IKeyedList<TKey, TValue>>
    IReadOnlyCollectionDictionary<TKey, TValue, IKeyedList<TKey, TValue>>
    IReadOnlyListDictionary<TKey, TValue>
    IReadOnlyCollectionDictionary<TKey, TValue, IReadOnlyKeyedList<TKey, TValue>>
    IReadOnlyCollectionDictionaryBase<TKey, TValue>
    Namespace: Singulink.Collections
    Assembly: Singulink.Collections.dll
    Syntax
    public class ListDictionary<TKey, TValue> : IListDictionary<TKey, TValue>, ICollectionDictionary<TKey, TValue, IKeyedList<TKey, TValue>>, IReadOnlyCollectionDictionary<TKey, TValue, IKeyedList<TKey, TValue>>, IReadOnlyListDictionary<TKey, TValue>, IReadOnlyCollectionDictionary<TKey, TValue, IReadOnlyKeyedList<TKey, TValue>>, IReadOnlyCollectionDictionaryBase<TKey, TValue> 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 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.

    ValueCount

    Gets the total 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 across all the keys in the dictionary.

    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)

    Determines whether the dictionary contains the specified key associated with the specified value.

    ContainsKey(TKey)

    Determines 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.

    GetAlternateLookup<TAlternateKey>()

    Gets an alternate lookup that can be used to perform operations on this dictionary using TAlternateKey instead of TKey.

    GetEnumerator()

    Returns an enumerator that iterates through the value lists in the dictionary.

    GetValueCount(TKey)

    Gets the number of values associated with the specified key, or zero if the key is not present.

    ToLookup()

    Creates a snapshot ILookup<TKey, TElement> by copying the current contents of the dictionary using its KeyComparer. Subsequent changes to the dictionary are not reflected in the returned lookup.

    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.

    TryGetAlternateLookup<TAlternateKey>(out AlternateLookup<TAlternateKey>)

    Attempts to get an alternate lookup that can be used to perform operations on this dictionary using TAlternateKey instead of TKey.

    TryGetValues(TKey, out ValueList)

    Gets the keyed value collection associated with the specified key.

    Explicit Interface Implementations

    Name Description
    ICollectionDictionary<TKey, TValue, IKeyedList<TKey, 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.

    IListDictionary<TKey, 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.

    IListDictionary<TKey, TValue>.TryGetValues(TKey, out IKeyedList<TKey, TValue>)

    Gets the keyed value collection associated with the specified key.

    IListDictionary<TKey, TValue>.ValueCollections

    Gets a collection containing the value lists in the dictionary.

    IReadOnlyCollectionDictionaryBase<TKey, TValue>.Keys

    Gets a collection containing the keys in the dictionary.

    IReadOnlyCollectionDictionaryBase<TKey, TValue>.Values

    Gets a collection containing all the values across all the keys in the dictionary.

    IReadOnlyCollectionDictionary<TKey, TValue, IKeyedList<TKey, 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.

    IReadOnlyCollectionDictionary<TKey, TValue, IKeyedList<TKey, TValue>>.TryGetValues(TKey, out IKeyedList<TKey, TValue>)

    Gets the keyed value collection associated with the specified key.

    IReadOnlyCollectionDictionary<TKey, TValue, IKeyedList<TKey, TValue>>.ValueCollections

    Gets a collection containing the keyed value collections in the dictionary.

    IReadOnlyCollectionDictionary<TKey, TValue, IReadOnlyKeyedList<TKey, 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.

    IReadOnlyCollectionDictionary<TKey, TValue, IReadOnlyKeyedList<TKey, TValue>>.TryGetValues(TKey, out IReadOnlyKeyedList<TKey, TValue>)

    Gets the keyed value collection associated with the specified key.

    IReadOnlyCollectionDictionary<TKey, TValue, IReadOnlyKeyedList<TKey, TValue>>.ValueCollections

    Gets a collection containing the keyed value collections in the dictionary.

    Extension Methods

    CollectionDictionaryExtensions.AsCollectionDictionary<TKey, TValue>(IListDictionary<TKey, TValue>)
    CollectionDictionaryExtensions.AsReadOnly<TKey, TValue>(IListDictionary<TKey, TValue>)
    CollectionDictionaryExtensions.AsLookup<TKey, TValue>(IReadOnlyListDictionary<TKey, TValue>)
    CollectionDictionaryExtensions.AsReadOnlyCollectionDictionary<TKey, TValue>(IReadOnlyListDictionary<TKey, TValue>)
    CollectionDictionaryExtensions.ToLookup<TKey, TValue>(IReadOnlyListDictionary<TKey, TValue>, IEqualityComparer<TKey>?)
    © Singulink. All rights reserved.