Class MultiDictionary<TKey, TValue>
- Namespace
- ICSharpCode.Decompiler.Util
- Assembly
- ICSharpCode.Decompiler.dll
A dictionary that allows multiple pairs with the same key.
public class MultiDictionary<TKey, TValue> : ILookup<TKey, TValue>, IEnumerable<IGrouping<TKey, TValue>>, IEnumerable where TKey : notnull
Type Parameters
TKey
TValue
- Inheritance
-
MultiDictionary<TKey, TValue>
- Implements
-
ILookup<TKey, TValue>IEnumerable<IGrouping<TKey, TValue>>
- Inherited Members
Constructors
MultiDictionary()
public MultiDictionary()
MultiDictionary(IEqualityComparer<TKey>?)
public MultiDictionary(IEqualityComparer<TKey>? comparer)
Parameters
comparer
IEqualityComparer<TKey>
Properties
Count
Returns the number of different keys.
public int Count { get; }
Property Value
this[TKey]
public IReadOnlyList<TValue> this[TKey key] { get; }
Parameters
key
TKey
Property Value
- IReadOnlyList<TValue>
Keys
public ICollection<TKey> Keys { get; }
Property Value
- ICollection<TKey>
Values
public IEnumerable<TValue> Values { get; }
Property Value
- IEnumerable<TValue>
Methods
Add(TKey, TValue)
public void Add(TKey key, TValue value)
Parameters
key
TKeyvalue
TValue
Clear()
public void Clear()
Contains(TKey)
public bool Contains(TKey key)
Parameters
key
TKey
Returns
GetEnumerator()
public IEnumerator<IGrouping<TKey, TValue>> GetEnumerator()
Returns
- IEnumerator<IGrouping<TKey, TValue>>
Remove(TKey, TValue)
public bool Remove(TKey key, TValue value)
Parameters
key
TKeyvalue
TValue
Returns
RemoveAll(TKey)
Removes all entries with the specified key.
public bool RemoveAll(TKey key)
Parameters
key
TKey
Returns
- bool
Returns true if at least one entry was removed.