forked from CommunityToolkit/WindowsCommunityToolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIIncrementalSource.cs
More file actions
35 lines (33 loc) · 1.53 KB
/
IIncrementalSource.cs
File metadata and controls
35 lines (33 loc) · 1.53 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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.Toolkit.Collections
{
/// <summary>
/// This interface represents a data source whose items can be loaded incrementally.
/// </summary>
/// <typeparam name="TSource">Type of collection element.</typeparam>
public interface IIncrementalSource<TSource>
{
/// <summary>
/// This method is invoked everytime the view need to show more items. Retrieves items based on <paramref name="pageIndex"/> and <paramref name="pageSize"/> arguments.
/// </summary>
/// <param name="pageIndex">
/// The zero-based index of the page that corresponds to the items to retrieve.
/// </param>
/// <param name="pageSize">
/// The number of <typeparamref name="TSource"/> items to retrieve for the specified <paramref name="pageIndex"/>.
/// </param>
/// <param name="cancellationToken">
/// Used to propagate notification that operation should be canceled.
/// </param>
/// <returns>
/// Returns a collection of <typeparamref name="TSource"/>.
/// </returns>
Task<IEnumerable<TSource>> GetPagedItemsAsync(int pageIndex, int pageSize, CancellationToken cancellationToken = default(CancellationToken));
}
}