Пример #1
0
        /// <summary>
        /// Initializes a new instance of the SearchResultCollection class
        /// </summary>
        /// <param name="pager">The search pager used for result enumeration</param>
        internal SearchResultCollection(SearchResultPager pager)
        {
            if (pager == null)
            {
                throw new ArgumentNullException(nameof(pager));
            }

            this.pager     = pager;
            this.resultSet = new List <ResourceObject>();
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the SearchResultCollectionAsync class
        /// </summary>
        /// <param name="pager">The search pager used for the results enumeration</param>
        /// <param name="tokenSource">The cancellation token source that can be used to abort the async operation</param>
        internal SearchResultCollectionAsync(SearchResultPager pager, CancellationTokenSource tokenSource)
        {
            if (pager == null)
            {
                throw new ArgumentNullException(nameof(pager));
            }

            this.resultSet           = new BlockingCollection <ResourceObject>();
            this.consumingEnumerable = this.resultSet.GetConsumingEnumerable();

            if (tokenSource != null)
            {
                this.token = tokenSource.Token;
            }

            this.pager = pager;
            this.ExecuteProducer();
        }