Dela via


PaginationHelper.ForEach<T> Method

Definition

Perform an action for each page of a paginated response, requesting the next page after the action completes.

public static void ForEach<T> (Func<Microsoft.Rest.Azure.IPage<T>> getFirstPage, Func<string,Microsoft.Rest.Azure.IPage<T>> getNextPage, Action<System.Collections.Generic.IEnumerable<T>> action, int numberOfResults, System.Threading.CancellationToken cancellationToken);
static member ForEach : Func<Microsoft.Rest.Azure.IPage<'T>> * Func<string, Microsoft.Rest.Azure.IPage<'T>> * Action<seq<'T>> * int * System.Threading.CancellationToken -> unit
Public Shared Sub ForEach(Of T) (getFirstPage As Func(Of IPage(Of T)), getNextPage As Func(Of String, IPage(Of T)), action As Action(Of IEnumerable(Of T)), numberOfResults As Integer, cancellationToken As CancellationToken)

Type Parameters

T

The type of object expected in the response

Parameters

getFirstPage
Func<IPage<T>>

A function that will request the first page

getNextPage
Func<String,IPage<T>>

A function that will consume a nextLink and request further pages

action
Action<IEnumerable<T>>

The action to perform on each page.

numberOfResults
Int32

The maximum number of results to return.

cancellationToken
CancellationToken

The cancellation token.

Applies to