コード例 #1
0
        public static IEnumerable <Response <T> > CreateEnumerable <T>(Func <string, PageResponse <T> > pageFunc)
        {
            string nextLink = null;

            do
            {
                PageResponse <T> pageResponse = pageFunc(nextLink);
                foreach (T setting in pageResponse.Values)
                {
                    yield return(new Response <T>(pageResponse.Response, setting));
                }
                nextLink = pageResponse.NextLink;
            } while (nextLink != null);
        }
コード例 #2
0
        public static async IAsyncEnumerable <Response <T> > CreateAsyncEnumerable <T>(Func <string, Task <PageResponse <T> > > pageFunc)
        {
            string nextLink = null;

            do
            {
                PageResponse <T> pageResponse = await pageFunc(nextLink).ConfigureAwait(false);

                foreach (T setting in pageResponse.Values)
                {
                    yield return(new Response <T>(pageResponse.Response, setting));
                }
                nextLink = pageResponse.NextLink;
            } while (nextLink != null);
        }