Class Multimap<TKey, TValue>
A dictionary in which one key has many associated values.
Implements
Inherited Members
Namespace: mailslurp.Client
Assembly: mailslurp.dll
Syntax
public class Multimap<TKey, TValue> : IDictionary<TKey, IList<TValue>>, ICollection<KeyValuePair<TKey, IList<TValue>>>, IEnumerable<KeyValuePair<TKey, IList<TValue>>>, IEnumerable
Type Parameters
Name | Description |
---|---|
TKey | The type of the key |
TValue | The type of the value associated with the key. |
Constructors
View SourceMultimap()
Empty Constructor.
Declaration
public Multimap()
Multimap(IEqualityComparer<TKey>)
Constructor with comparer.
Declaration
public Multimap(IEqualityComparer<TKey> comparer)
Parameters
Type | Name | Description |
---|---|---|
IEqualityComparer<TKey> | comparer |
Properties
View SourceCount
Gets the number of items contained in the Multimap.
Declaration
public int Count { get; }
Property Value
Type | Description |
---|---|
int |
IsReadOnly
Gets a value indicating whether the Multimap is read-only.
Declaration
public bool IsReadOnly { get; }
Property Value
Type | Description |
---|---|
bool |
this[TKey]
Gets or sets the item with the specified key.
Declaration
public IList<TValue> this[TKey key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key of the item to get or set. |
Property Value
Type | Description |
---|---|
IList<TValue> | The value of the specified key. |
Keys
Gets a System.Collections.Generic.ICollection containing the keys of the Multimap.
Declaration
public ICollection<TKey> Keys { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.ICollection<T><TKey> |
Values
Gets a System.Collections.Generic.ICollection containing the values of the Multimap.
Declaration
public ICollection<IList<TValue>> Values { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.ICollection<T><IList<TValue>> |
Methods
View SourceAdd(TKey, TValue)
Adds an item with the provided key and value to the Multimap.
Declaration
public void Add(TKey key, TValue value)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The object to use as the key of the item to add. |
TValue | value | The object to use as the value of the item to add. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown when couldn't add value to Multimap. |
Add(TKey, IList<TValue>)
Adds an item with the provided key and value to the Multimap.
Declaration
public void Add(TKey key, IList<TValue> value)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The object to use as the key of the item to add. |
IList<TValue> | value | The object to use as the value of the item to add. |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Thrown when couldn't add the value to Multimap. |
Add(Multimap<TKey, TValue>)
Add Multimap to Multimap
Declaration
public void Add(Multimap<TKey, TValue> multimap)
Parameters
Type | Name | Description |
---|---|---|
Multimap<TKey, TValue> | multimap | Multimap |
Add(KeyValuePair<TKey, IList<TValue>>)
Add values to Multimap
Declaration
public void Add(KeyValuePair<TKey, IList<TValue>> item)
Parameters
Type | Name | Description |
---|---|---|
KeyValuePair<TKey, IList<TValue>> | item | Key value pair |
Clear()
Clear Multimap
Declaration
public void Clear()
Contains(KeyValuePair<TKey, IList<TValue>>)
Determines whether Multimap contains the specified item.
Declaration
public bool Contains(KeyValuePair<TKey, IList<TValue>> item)
Parameters
Type | Name | Description |
---|---|---|
KeyValuePair<TKey, IList<TValue>> | item | Key value pair |
Returns
Type | Description |
---|---|
bool | true if the Multimap contains the item; otherwise, false. |
Exceptions
Type | Condition |
---|---|
NotImplementedException | Method needs to be implemented |
ContainsKey(TKey)
Determines whether the Multimap contains an item with the specified key.
Declaration
public bool ContainsKey(TKey key)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key to locate in the Multimap. |
Returns
Type | Description |
---|---|
bool | true if the Multimap contains an item with the key; otherwise, false. |
CopyTo(Array, int)
Copy the items of the Multimap to an System.Array, starting at a particular System.Array index.
Declaration
public void CopyTo(Array array, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Array | array | The one-dimensional System.Array that is the destination of the items copied from Multimap. The System.Array must have zero-based indexing. |
int | index | The zero-based index in array at which copying begins. |
CopyTo(KeyValuePair<TKey, IList<TValue>>[], int)
Copy items of the Multimap to an array, starting at a particular array index.
Declaration
public void CopyTo(KeyValuePair<TKey, IList<TValue>>[] array, int arrayIndex)
Parameters
Type | Name | Description |
---|---|---|
KeyValuePair<TKey, IList<TValue>>[] | array | The array that is the destination of the items copied from Multimap. The array must have zero-based indexing. |
int | arrayIndex | The zero-based index in array at which copying begins. |
Exceptions
Type | Condition |
---|---|
NotImplementedException | Method needs to be implemented |
GetEnumerator()
To get the enumerator.
Declaration
public IEnumerator<KeyValuePair<TKey, IList<TValue>>> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<KeyValuePair<TKey, IList<TValue>>> | Enumerator |
Remove(TKey)
Removes item with the specified key from the Multimap.
Declaration
public bool Remove(TKey key)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key to locate in the Multimap. |
Returns
Type | Description |
---|---|
bool | true if the item is successfully removed; otherwise, false. |
Remove(KeyValuePair<TKey, IList<TValue>>)
Removes the specified item from the Multimap.
Declaration
public bool Remove(KeyValuePair<TKey, IList<TValue>> item)
Parameters
Type | Name | Description |
---|---|---|
KeyValuePair<TKey, IList<TValue>> | item | Key value pair |
Returns
Type | Description |
---|---|
bool | true if the item is successfully removed; otherwise, false. |
Exceptions
Type | Condition |
---|---|
NotImplementedException | Method needs to be implemented |
TryGetValue(TKey, out IList<TValue>)
Gets the value associated with the specified key.
Declaration
public bool TryGetValue(TKey key, out IList<TValue> value)
Parameters
Type | Name | Description |
---|---|---|
TKey | key | The key whose value to get. |
IList<TValue> | value | When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized. |
Returns
Type | Description |
---|---|
bool | true if the object that implements Multimap contains an item with the specified key; otherwise, false. |