-
Notifications
You must be signed in to change notification settings - Fork 0
/
IReadOnlyMultiDictionary.cs
64 lines (55 loc) · 1.96 KB
/
IReadOnlyMultiDictionary.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Grammophone.GenericContentModel
{
/// <summary>
/// A read-only dictionary of items associated with keys, allowing for
/// multiple items having the same key.
/// </summary>
/// <typeparam name="K">The type of the keys.</typeparam>
/// <typeparam name="E">The type of the items.</typeparam>
/// <typeparam name="C">The type of collection under a key. Must descend from <see cref="IReadOnlyBag{E}"/>.</typeparam>
public interface IReadOnlyMultiDictionary<K, out E, out C> : IEnumerable<IReadOnlyKeyValuePair<K, C>>
where C : IReadOnlyBag<E>
{
#region Properties
/// <summary>
/// Number of items in the dictionary.
/// </summary>
int Count { get; }
/// <summary>
/// Get the collection of items by the specified <paramref name="key"/>.
/// If no items exist under the <paramref name="key"/>, an empty collection is returned.
/// </summary>
/// <param name="key">The key of the items.</param>
/// <returns>
/// Returns a read-only collection of items associated with the key, else returns an empty collection.
/// </returns>
/// <exception cref="ArgumentNullException">
/// The <paramref name="key"/> was null.
/// </exception>
C this[K key] { get; }
/// <summary>
/// The unique keys of all the items in the dictionary.
/// </summary>
IEnumerable<K> Keys { get; }
#endregion
#region Methods
/// <summary>
/// Returns true if at least one item is associated with the specified <paramref name="key"/>.
/// </summary>
bool ContainsKey(K key);
#endregion
}
/// <summary>
/// A read-only dictionary of items associated with keys, allowing for
/// multiple items having the same key.
/// </summary>
/// <typeparam name="K">The type of the keys.</typeparam>
/// <typeparam name="E">The type of the items.</typeparam>
public interface IReadOnlyMultiDictionary<K, out E> : IReadOnlyMultiDictionary<K, E, IReadOnlyBag<E>>
{
}
}