public virtual Pageable <LinkerResource> GetAll(CancellationToken cancellationToken = default) { Page <LinkerResource> FirstPageFunc(int?pageSizeHint) { using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.GetAll"); scope.Start(); try { var response = _linkerResourceLinkerRestClient.List(Id, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value.Select(value => new LinkerResource(Client, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } Page <LinkerResource> NextPageFunc(string nextLink, int?pageSizeHint) { using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.GetAll"); scope.Start(); try { var response = _linkerResourceLinkerRestClient.ListNextPage(nextLink, Id, cancellationToken: cancellationToken); return(Page.FromValues(response.Value.Value.Select(value => new LinkerResource(Client, value)), response.Value.NextLink, response.GetRawResponse())); } catch (Exception e) { scope.Failed(e); throw; } } return(PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc)); }