Repository navigation
Expand file tree
/
Copy pathIQuery.cs
More file actions
50 lines (43 loc) · 1.33 KB
/
Copy pathIQuery.cs
File metadata and controls
50 lines (43 loc) · 1.33 KB
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
// Copyright (c) 2011-2023 Roland Pheasant. All rights reserved.
// Roland Pheasant licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.
using DynamicData.Kernel;
// ReSharper disable once CheckNamespace
namespace DynamicData;
/// <summary>
/// Exposes internal cache state to enable querying.
/// </summary>
/// <typeparam name="TObject">The type of the object.</typeparam>
/// <typeparam name="TKey">The type of the key.</typeparam>
public interface IQuery<TObject, TKey>
where TObject : notnull
{
/// <summary>
/// Gets the count.
/// </summary>
int Count { get; }
/// <summary>
/// Gets the items.
/// </summary>
IEnumerable<TObject> Items { get; }
/// <summary>
/// Gets the keys.
/// </summary>
IEnumerable<TKey> Keys { get; }
/// <summary>
/// Gets the items together with their keys.
/// </summary>
/// <value>
/// The key values.
/// </value>
IEnumerable<KeyValuePair<TKey, TObject>> KeyValues { get; }
/// <summary>
/// Lookup a single item using the specified key.
/// </summary>
/// <remarks>
/// Fast indexed lookup.
/// </remarks>
/// <param name="key">The key.</param>
/// <returns>The looked up value.</returns>
Optional<TObject> Lookup(TKey key);
}