Пример #1
0
        private async Task <Item[]> GetNonStoredItemsAsync(IEnumerable <int> newStories)
        {
            var itemsToBeRetrieved = new List <Task <Item> >();

            foreach (var id in newStories)
            {
                if (!_items.ContainsKey(id))
                {
                    itemsToBeRetrieved.Add(_hackerNewsService.GetItemAsync(id));
                }
            }

            return(await Task.WhenAll(itemsToBeRetrieved));
        }