Exemple #1
0
        /// <summary>
        /// Gets IDs of top stories
        /// </summary>
        /// <param name="count">Defines how many IDs from the top will be returned</param>
        /// <returns>List of objects containing story ID and its rank</returns>
        public async Task <List <RankedStoryId> > GetTopStoryIds(int count)
        {
            var allIds = await dataFetcher.GetTopStoryIds();

            return(allIds
                   .Take(Math.Min(count, allIds.Length))
                   .Select((id, index) => new RankedStoryId {
                StoryId = id, Rank = index + 1
            })
                   .ToList());
        }